Skip to content

Commit c35d589

Browse files
author
lawrin
committed
The patch and the testcase for the Bug #18193771/71605 - the driver missed definitions of many collations(utf8mb4 in particular)
That could cause exception in resultset's metadata methods isCaseSensitive and getColumnDisplaySize if resultset's charset was one of those missing. The patch adds missing charsets to the array with charsets info, and fixes some minor errors in it(the array).
1 parent dcaef0d commit c35d589

File tree

3 files changed

+171
-49
lines changed

3 files changed

+171
-49
lines changed

driver/mysql_util.cpp

Lines changed: 116 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
33
44
The MySQL Connector/C++ is licensed under the terms of the GPLv2
55
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -82,6 +82,12 @@ void throwSQLException(::sql::mysql::NativeAPI::NativeStatementWrapper & proxy)
8282
#define check_mb_eucjpms NULL
8383
#define cppconn_mbcharlen_utf8 NULL
8484
#define check_mb_utf8_valid NULL
85+
#define cppconn_mbcharlen_utf8mb4 cppconn_mbcharlen_utf8
86+
#define check_mb_utf8mb4_valid check_mb_utf8_valid
87+
#define cppconn_mbcharlen_utf16 NULL
88+
#define check_mb_utf16_valid NULL
89+
#define cppconn_mbcharlen_utf32 NULL
90+
#define check_mb_utf32_valid NULL
8591

8692
/* {{{ our_charsets60 */
8793
const OUR_CHARSET our_charsets60[] =
@@ -151,7 +157,7 @@ const OUR_CHARSET our_charsets60[] =
151157
{ 68, "cp866", "cp866_bin", 1, 1, "", NULL, NULL},
152158
{ 69, "dec8", "dec8_bin", 1, 1, "", NULL, NULL},
153159
{ 70, "greek", "greek_bin", 1, 1, "", NULL, NULL},
154-
{ 71, "hebew", "hebrew_bin", 1, 1, "", NULL, NULL},
160+
{ 71, "hebrew", "hebrew_bin", 1, 1, "", NULL, NULL},
155161
{ 72, "hp8", "hp8_bin", 1, 1, "", NULL, NULL},
156162
{ 73, "keybcs2", "keybcs2_bin", 1, 1, "", NULL, NULL},
157163
{ 74, "koi8r", "koi8r_bin", 1, 1, "", NULL, NULL},
@@ -196,47 +202,114 @@ const OUR_CHARSET our_charsets60[] =
196202
{ 145, "ucs2", "ucs2_esperanto_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
197203
{ 146, "ucs2", "ucs2_hungarian_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
198204
{ 147, "ucs2", "ucs2_sinhala_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
199-
{ 192, "utf8mb3", "utf8mb3_general_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
200-
{ 193, "utf8mb3", "utf8mb3_icelandic_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
201-
{ 194, "utf8mb3", "utf8mb3_latvian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
202-
{ 195, "utf8mb3", "utf8mb3_romanian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
203-
{ 196, "utf8mb3", "utf8mb3_slovenian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
204-
{ 197, "utf8mb3", "utf8mb3_polish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
205-
{ 198, "utf8mb3", "utf8mb3_estonian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
206-
{ 119, "utf8mb3", "utf8mb3_spanish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
207-
{ 200, "utf8mb3", "utf8mb3_swedish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
208-
{ 201, "utf8mb3", "utf8mb3_turkish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
209-
{ 202, "utf8mb3", "utf8mb3_czech_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
210-
{ 203, "utf8mb3", "utf8mb3_danish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid },
211-
{ 204, "utf8mb3", "utf8mb3_lithunian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid },
212-
{ 205, "utf8mb3", "utf8mb3_slovak_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
213-
{ 206, "utf8mb3", "utf8mb3_spanish2_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
214-
{ 207, "utf8mb3", "utf8mb3_roman_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
215-
{ 208, "utf8mb3", "utf8mb3_persian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
216-
{ 209, "utf8mb3", "utf8mb3_esperanto_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
217-
{ 210, "utf8mb3", "utf8mb3_hungarian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
218-
{ 211, "utf8mb3", "utf8mb3_sinhala_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
219-
{ 224, "utf8", "utf8_unicode_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
220-
{ 225, "utf8", "utf8_icelandic_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
221-
{ 226, "utf8", "utf8_latvian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
222-
{ 227, "utf8", "utf8_romanian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
223-
{ 228, "utf8", "utf8_slovenian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
224-
{ 229, "utf8", "utf8_polish_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
225-
{ 230, "utf8", "utf8_estonian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
226-
{ 231, "utf8", "utf8_spanish_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
227-
{ 232, "utf8", "utf8_swedish_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
228-
{ 233, "utf8", "utf8_turkish_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
229-
{ 234, "utf8", "utf8_czech_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
230-
{ 235, "utf8", "utf8_danish_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
231-
{ 236, "utf8", "utf8_lithuanian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
232-
{ 237, "utf8", "utf8_slovak_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
233-
{ 238, "utf8", "utf8_spanish2_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
234-
{ 239, "utf8", "utf8_roman_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
235-
{ 240, "utf8", "utf8_persian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
236-
{ 241, "utf8", "utf8_esperanto_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
237-
{ 242, "utf8", "utf8_hungarian_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
238-
{ 243, "utf8", "utf8_sinhala_ci", 1, 4, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
239-
{ 254, "utf8mb3", "utf8mb3_general_cs", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
205+
{ 148, "ucs2", "ucs2_german2_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
206+
{ 149, "ucs2", "ucs2_croatian_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
207+
{ 150, "ucs2", "ucs2_unicode_520_ci", 2, 2, "", cppconn_mbcharlen_ucs2, check_mb_ucs2},
208+
{ 192, "utf8", "utf8_unicode_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
209+
{ 193, "utf8", "utf8_icelandic_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
210+
{ 194, "utf8", "utf8_latvian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
211+
{ 195, "utf8", "utf8_romanian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
212+
{ 196, "utf8", "utf8_slovenian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
213+
{ 197, "utf8", "utf8_polish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
214+
{ 198, "utf8", "utf8_estonian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
215+
{ 199, "utf8", "utf8_spanish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
216+
{ 200, "utf8", "utf8_swedish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
217+
{ 201, "utf8", "utf8_turkish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
218+
{ 202, "utf8", "utf8_czech_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
219+
{ 203, "utf8", "utf8_danish_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid },
220+
{ 204, "utf8", "utf8_lithunian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid },
221+
{ 205, "utf8", "utf8_slovak_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
222+
{ 206, "utf8", "utf8_spanish2_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
223+
{ 207, "utf8", "utf8_roman_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
224+
{ 208, "utf8", "utf8_persian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
225+
{ 209, "utf8", "utf8_esperanto_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
226+
{ 210, "utf8", "utf8_hungarian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
227+
{ 211, "utf8", "utf8_sinhala_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
228+
{ 212, "utf8", "utf8_german2_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
229+
{ 213, "utf8", "utf8_croatian_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
230+
{ 214, "utf8", "utf8_unicode_520_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
231+
{ 215, "utf8", "utf8_vietnamese_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
232+
{ 223, "utf8", "utf8_general_mysql500_ci", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
233+
{ 45, "utf8mb4", "utf8mb4_general_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
234+
{ 46, "utf8mb4", "utf8mb4_bin", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
235+
{ 224, "utf8mb4", "utf8mb4_unicode_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
236+
{ 225, "utf8mb4", "utf8mb4_icelandic_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
237+
{ 226, "utf8mb4", "utf8mb4_latvian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
238+
{ 227, "utf8mb4", "utf8mb4_romanian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
239+
{ 228, "utf8mb4", "utf8mb4_slovenian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
240+
{ 229, "utf8mb4", "utf8mb4_polish_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
241+
{ 230, "utf8mb4", "utf8mb4_estonian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
242+
{ 231, "utf8mb4", "utf8mb4_spanish_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
243+
{ 232, "utf8mb4", "utf8mb4_swedish_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
244+
{ 233, "utf8mb4", "utf8mb4_turkish_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
245+
{ 234, "utf8mb4", "utf8mb4_czech_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
246+
{ 235, "utf8mb4", "utf8mb4_danish_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
247+
{ 236, "utf8mb4", "utf8mb4_lithuanian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
248+
{ 237, "utf8mb4", "utf8mb4_slovak_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
249+
{ 238, "utf8mb4", "utf8mb4_spanish2_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
250+
{ 239, "utf8mb4", "utf8mb4_roman_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
251+
{ 240, "utf8mb4", "utf8mb4_persian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
252+
{ 241, "utf8mb4", "utf8mb4_esperanto_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
253+
{ 242, "utf8mb4", "utf8mb4_hungarian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
254+
{ 243, "utf8mb4", "utf8mb4_sinhala_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
255+
{ 244, "utf8mb4", "utf8mb4_german2_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
256+
{ 245, "utf8mb4", "utf8mb4_croatian_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
257+
{ 246, "utf8mb4", "utf8mb4_unicode_520_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
258+
{ 247, "utf8mb4", "utf8mb4_vietnamese_ci", 1, 4, "", cppconn_mbcharlen_utf8mb4, check_mb_utf8mb4_valid},
259+
260+
/*Should not really happen, but adding them */
261+
{ 254, "utf8", "utf8_general_cs", 1, 3, "", cppconn_mbcharlen_utf8, check_mb_utf8_valid},
262+
263+
{ 101, "utf16", "utf16_unicode_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
264+
{ 102, "utf16", "utf16_icelandic_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
265+
{ 103, "utf16", "utf16_latvian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
266+
{ 104, "utf16", "utf16_romanian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
267+
{ 105, "utf16", "utf16_slovenian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
268+
{ 106, "utf16", "utf16_polish_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
269+
{ 107, "utf16", "utf16_estonian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
270+
{ 108, "utf16", "utf16_spanish_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
271+
{ 109, "utf16", "utf16_swedish_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
272+
{ 110, "utf16", "utf16_turkish_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
273+
{ 111, "utf16", "utf16_czech_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
274+
{ 112, "utf16", "utf16_danish_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
275+
{ 113, "utf16", "utf16_lithuanian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
276+
{ 114, "utf16", "utf16_slovak_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
277+
{ 115, "utf16", "utf16_spanish2_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
278+
{ 116, "utf16", "utf16_roman_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
279+
{ 117, "utf16", "utf16_persian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
280+
{ 118, "utf16", "utf16_esperanto_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
281+
{ 119, "utf16", "utf16_hungarian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
282+
{ 120, "utf16", "utf16_sinhala_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
283+
{ 121, "utf16", "utf16_german2_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
284+
{ 122, "utf16", "utf16_croatian_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
285+
{ 123, "utf16", "utf16_unicode_520_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
286+
{ 124, "utf16", "utf16_vietnamese_ci", 2, 4, "", cppconn_mbcharlen_utf16, check_mb_utf16_valid},
287+
288+
{ 160, "utf32", "utf32_unicode_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
289+
{ 161, "utf32", "utf32_icelandic_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
290+
{ 162, "utf32", "utf32_latvian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
291+
{ 163, "utf32", "utf32_romanian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
292+
{ 164, "utf32", "utf32_slovenian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
293+
{ 165, "utf32", "utf32_polish_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
294+
{ 166, "utf32", "utf32_estonian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
295+
{ 167, "utf32", "utf32_spanish_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
296+
{ 168, "utf32", "utf32_swedish_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
297+
{ 169, "utf32", "utf32_turkish_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
298+
{ 170, "utf32", "utf32_czech_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
299+
{ 171, "utf32", "utf32_danish_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
300+
{ 172, "utf32", "utf32_lithuanian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
301+
{ 173, "utf32", "utf32_slovak_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
302+
{ 174, "utf32", "utf32_spanish2_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
303+
{ 175, "utf32", "utf32_roman_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
304+
{ 176, "utf32", "utf32_persian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
305+
{ 177, "utf32", "utf32_esperanto_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
306+
{ 178, "utf32", "utf32_hungarian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
307+
{ 179, "utf32", "utf32_sinhala_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
308+
{ 180, "utf32", "utf32_german2_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
309+
{ 181, "utf32", "utf32_croatian_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
310+
{ 182, "utf32", "utf32_unicode_520_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
311+
{ 183, "utf32", "utf32_vietnamese_ci", 4, 4, "", cppconn_mbcharlen_utf32, check_mb_utf32_valid},
312+
240313
{ 0, NULL, NULL, 0, 0, NULL, NULL, NULL}
241314
};
242315
/* }}} */

test/unit/bugs/bugs.cpp

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
33
44
The MySQL Connector/C++ is licensed under the terms of the GPLv2
55
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -71,8 +71,8 @@ void bugs::net_write_timeout39878()
7171
TestsListener::messagesLog() << "We've set net_write_timeout to " << res->getString(2) << std::endl;
7272

7373

74-
stmt->execute("drop table if exists bug39878");
75-
stmt->execute("create table bug39878 (id int unsigned not null)");
74+
stmt->executeUpdate("drop table if exists bug39878");
75+
stmt->executeUpdate("create table bug39878 (id int unsigned not null)");
7676

7777
stmt->execute("lock table bug39878 write");
7878

@@ -138,6 +138,7 @@ void bugs::net_write_timeout39878()
138138
ASSERT_EQUALS(rowsCount, rowsRead);
139139
}
140140

141+
141142
void bugs::store_result_error_51562()
142143
{
143144
std::stringstream msg;
@@ -223,7 +224,9 @@ void bugs::supportIssue_52319()
223224
logMsg("Test for MySQL support issue 52319");
224225

225226
stmt->execute("DROP TABLE IF EXISTS products");
226-
stmt->execute("CREATE TABLE products (uiProductsIdx int(10) unsigned NOT NULL AUTO_INCREMENT, startTime timestamp NULL DEFAULT NULL, stopTime timestamp NULL DEFAULT NULL, uiProductsID int(10) DEFAULT NULL, uiParameterSetID int(10) unsigned DEFAULT NULL, PRIMARY KEY (uiProductsIdx))");
227+
createSchemaObject("TABLE",
228+
"products",
229+
"(uiProductsIdx int(10) unsigned NOT NULL AUTO_INCREMENT, startTime timestamp NULL DEFAULT NULL, stopTime timestamp NULL DEFAULT NULL, uiProductsID int(10) DEFAULT NULL, uiParameterSetID int(10) unsigned DEFAULT NULL, PRIMARY KEY (uiProductsIdx))");
227230

228231
stmt->execute("DROP PROCEDURE IF EXISTS insertProduct");
229232
stmt->execute("CREATE PROCEDURE insertProduct(IN dwStartTimeIN INT UNSIGNED, IN uiProductsIDIN INT UNSIGNED, IN dwParSetIDIN INT UNSIGNED) BEGIN DECLARE stStartTime TIMESTAMP; SET stStartTime = FROM_UNIXTIME(dwStartTimeIN); INSERT INTO `products` (startTime, uiProductsID, uiParameterSetID) VALUES (stStartTime, uiProductsIDIN, dwParSetIDIN); END");
@@ -281,8 +284,8 @@ void bugs::expired_pwd()
281284

282285
sql::ConnectOptionsMap opts;
283286

284-
opts["userName"]= sql::SQLString("ccpp_expired_pwd");
285-
opts["password"]= sql::SQLString("foo");
287+
opts["userName"]= sql::SQLString("ccpp_expired_pwd");
288+
opts["password"]= sql::SQLString("foo");
286289

287290
testsuite::Connection c2;
288291

@@ -452,5 +455,48 @@ void bugs::legacy_auth()
452455
stmt->executeUpdate("DROP USER ccpp_legacy_auth");
453456
}
454457

458+
459+
/* Bug #18193771/71605 - The driver does not recognize utf8mb4 charset */
460+
void bugs::bug71606()
461+
{
462+
if (getMySQLVersion(con) < 56000)
463+
{
464+
SKIP("The server does not support tested functionality(utf8mb4 charset)");
465+
}
466+
467+
/* We only loop thru default collations - thus the testcase does not cover all
468+
possible cases */
469+
res.reset(stmt->executeQuery("SHOW CHARSET"));
470+
471+
/* Connection is reset after the testcase finishes - thus we can safely "set names" here */
472+
Statement stmt2(con->createStatement());
473+
pstmt.reset(con->prepareStatement("SELECT 'a'"));
474+
ResultSet res2;
475+
ResultSetMetaData *rsmd2;
476+
477+
while (res->next())
478+
{
479+
String csname(res->getString(1));
480+
String query("SET NAMES ");
481+
482+
query.append(res->getString(1));
483+
484+
try
485+
{
486+
stmt2->executeUpdate(query);
487+
}
488+
catch(sql::SQLException &)
489+
{
490+
/* Assuming this particular charset charset cannot be set as client charset,
491+
like atm we can't do that with utf16/32 */
492+
continue;
493+
}
494+
495+
res2.reset(pstmt->executeQuery());
496+
rsmd2= res2->getMetaData();
497+
rsmd2->isCaseSensitive(1);
498+
}
499+
}
500+
455501
} /* namespace regression */
456502
} /* namespace testsuite */

test/unit/bugs/bugs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class bugs : public unit_fixture
5454
TEST_CASE(supportIssue_52319);
5555
TEST_CASE(expired_pwd);
5656
TEST_CASE(legacy_auth);
57+
TEST_CASE(bug71606);
5758
}
5859

5960
/**
@@ -81,6 +82,8 @@ class bugs : public unit_fixture
8182

8283
void legacy_auth();
8384

85+
void bug71606();
86+
8487
};
8588

8689
REGISTER_FIXTURE(bugs);

0 commit comments

Comments
 (0)