File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,31 @@ public:
8181 return _names[index];
8282 }
8383
84+ @(" getName" )
85+ debug (MYSQLN_TESTS )
86+ unittest
87+ {
88+ import mysql.test.common;
89+ import mysql.commands;
90+ mixin (scopedCn);
91+ cn.exec(" DROP TABLE IF EXISTS `row_getName`" );
92+ cn.exec(" CREATE TABLE `row_getName` (someValue INTEGER, another INTEGER) ENGINE=InnoDB DEFAULT CHARSET=utf8" );
93+ cn.exec(" INSERT INTO `row_getName` VALUES (1, 2), (3, 4)" );
94+
95+ enum sql = " SELECT another, someValue FROM `row_getName`" ;
96+
97+ auto rows = cn.query(sql).array;
98+ assert (rows.length == 2 );
99+ assert (rows[0 ][0 ] == 2 );
100+ assert (rows[0 ][1 ] == 1 );
101+ assert (rows[0 ].getName(0 ) == " another" );
102+ assert (rows[0 ].getName(1 ) == " someValue" );
103+ assert (rows[1 ][0 ] == 4 );
104+ assert (rows[1 ][1 ] == 3 );
105+ assert (rows[1 ].getName(0 ) == " another" );
106+ assert (rows[1 ].getName(1 ) == " someValue" );
107+ }
108+
84109 /+ +
85110 Check if a column in the result row was NULL
86111
You can’t perform that action at this time.
0 commit comments