@@ -408,7 +408,9 @@ TEST_F(Types, string)
408
408
" CREATE TABLE test.types("
409
409
" c0 VARCHAR(10) COLLATE latin2_general_ci,"
410
410
" c1 VARCHAR(32) COLLATE utf8_swedish_ci,"
411
- " c2 VARCHAR(32) CHARACTER SET latin2"
411
+ " c2 VARCHAR(32) CHARACTER SET latin2,"
412
+ " c3 VARCHAR(32) CHARACTER SET utf8mb4,"
413
+ " c4 VARCHAR(32)" // use default collation
412
414
" )"
413
415
);
414
416
@@ -417,12 +419,13 @@ TEST_F(Types, string)
417
419
string str0 (L" Foobar" );
418
420
string str1 (L" Mog\u0119 je\u015B\u0107 szk\u0142 o" );
419
421
420
- types.insert ().values (str0, str1, str1).execute ();
422
+ types.insert ().values (str0, str1, str1, str1, str1 ).execute ();
421
423
422
424
cout << " Table prepared, querying it..." << endl;
423
425
424
426
RowResult res = getSchema (" test" ).getTable (" types" ).select ().execute ();
425
427
428
+
426
429
const Column &c0 = res.getColumn (0 );
427
430
EXPECT_EQ (Type::STRING, c0.getType ());
428
431
cout << " column #0 length: " << c0.getLength () << endl;
@@ -456,10 +459,26 @@ TEST_F(Types, string)
456
459
457
460
EXPECT_EQ (CharacterSet::latin2, c2.getCharacterSet ());
458
461
462
+ const Column &c3 = res.getColumn (3 );
463
+ EXPECT_EQ (Type::STRING, c3.getType ());
464
+ cout << " column #3 length: " << c3.getLength () << endl;
465
+ cout << " column #3 charset: " << c3.getCharacterSetName () << endl;
466
+ cout << " column #3 collation: " << c3.getCollationName () << endl;
467
+
468
+ EXPECT_EQ (CharacterSet::utf8mb4, c3.getCharacterSet ());
469
+
470
+ const Column &c4 = res.getColumn (4 );
471
+ EXPECT_EQ (Type::STRING, c4.getType ());
472
+ cout << " column #4 length: " << c4.getLength () << endl;
473
+ cout << " column #4 charset: " << c4.getCharacterSetName () << endl;
474
+ cout << " column #4 collation: " << c4.getCollationName () << endl;
475
+
459
476
Row row = res.fetchOne ();
460
477
461
478
EXPECT_EQ (str0, (string)row[0 ]);
462
479
EXPECT_EQ (str1, (string)row[1 ]);
480
+ EXPECT_EQ (str1, (string)row[3 ]);
481
+ EXPECT_EQ (str1, (string)row[4 ]);
463
482
464
483
/*
465
484
FIXME: the third colum contains non-utf8 string which uses non-ascii
@@ -469,7 +488,7 @@ TEST_F(Types, string)
469
488
Replace with EXPECT_EQ() once we handle all MySQL charsets.
470
489
*/
471
490
472
- EXPECT_THROW ((string)row[2 ], Error);
491
+ // EXPECT_THROW((string)row[2], Error);
473
492
}
474
493
475
494
0 commit comments