From: Andrey Hristov Date: Tue, 25 Mar 2008 18:28:13 +0000 (+0000) Subject: MFB : Fix for Bug #43832 mysqi_get_charset() doesn't expose charset comment X-Git-Tag: RELEASE_2_0_0a1~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bf96fdf5ccf090f042b027bd82289b6e86563c4;p=php MFB : Fix for Bug #43832 mysqi_get_charset() doesn't expose charset comment --- diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 80fb2ea5aa..210dcce944 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -706,7 +706,7 @@ PHP_FUNCTION(mysqli_get_charset) { MY_MYSQL *mysql; zval *mysql_link; - char *name = NULL, *collation = NULL, *dir = NULL; + const char *name = NULL, *collation = NULL, *dir = NULL, *comment = NULL; uint minlength, maxlength, number, state; #if !defined(MYSQLI_USE_MYSQLND) MY_CHARSET_INFO cs; @@ -730,6 +730,7 @@ PHP_FUNCTION(mysqli_get_charset) maxlength = cs.mbmaxlen; number = cs.number; state = cs.state; + comment = cs.comment; #else cs = mysql->mysql->charset; name = cs->name; @@ -737,25 +738,14 @@ PHP_FUNCTION(mysqli_get_charset) minlength = cs->char_minlen; maxlength = cs->char_maxlen; number = cs->nr; + comment = cs->comment; state = 1; /* all charsets are compiled in */ #endif if (UG(unicode)) { - UChar *ustr = NULL; - int ulen; - - zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, (name) ? name : "", - (name) ? strlen(name) : 0 TSRMLS_CC); - add_property_unicodel(return_value, "charset", ustr, ulen, 1); - efree(ustr); - zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, (collation) ? collation : "", - (collation) ? strlen(collation) : 0 TSRMLS_CC); - add_property_unicodel(return_value, "collation", ustr, ulen, 1); - efree(ustr); - zend_string_to_unicode(UG(utf8_conv), &ustr, &ulen, (dir) ? dir : "", - (dir) ? strlen(dir) : 0 TSRMLS_CC); - add_property_unicodel(return_value, "dir", ustr, ulen, 1); - efree(ustr); + add_property_utf8_string(return_value, "charset", (name) ? (char *)name : "", 1); + add_property_utf8_string(return_value, "collation", (collation) ? (char *)collation : "", 1); + add_property_utf8_string(return_value, "dir", (dir) ? (char *)dir : "", 1); } else { add_property_string(return_value, "charset", (name) ? (char *)name : "", 1); add_property_string(return_value, "collation",(collation) ? (char *)collation : "", 1); @@ -765,6 +755,11 @@ PHP_FUNCTION(mysqli_get_charset) add_property_long(return_value, "max_length", maxlength); add_property_long(return_value, "number", number); add_property_long(return_value, "state", state); + if (UG(unicode)) { + add_property_utf8_string(return_value, "comment", (comment) ? (char *)comment : "", 1); + } else { + add_property_string(return_value, "comment", (comment) ? (char *)comment : "", 1); + } } /* }}} */ #endif diff --git a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt index 75153cc095..27b66c0c0c 100644 --- a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt +++ b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt @@ -1,5 +1,5 @@ --TEST-- -mysqli_stmt_bind_param() - playing with references +Playing with datatype change between prepare and execute --SKIPIF-- query("create table type_change(a int, b char(10))"); $c1->query("insert into type_change values (1, 'one'), (2, 'two')"); $s1 = $c1->prepare("select a from type_change order by a"); - var_dump($s1); var_dump($s1->execute(), $s1->bind_result($col1)); echo "---- Row 1\n"; var_dump($s1->fetch()); @@ -58,26 +57,6 @@ require_once('skipifconnectfailure.inc'); echo "done!"; ?> --EXPECTF-- -object(mysqli_stmt)#%d (%d) { - ["affected_rows"]=> - int(0) - ["insert_id"]=> - int(0) - ["num_rows"]=> - int(0) - ["param_count"]=> - int(0) - ["field_count"]=> - int(1) - ["errno"]=> - int(0) - ["error"]=> - string(0) "" - ["sqlstate"]=> - string(5) "00000" - ["id"]=> - int(1) -} bool(true) bool(true) ---- Row 1 @@ -104,26 +83,6 @@ bool(false) ---- done! --UEXPECTF-- -object(mysqli_stmt)#%d (%d) { - [u"affected_rows"]=> - int(0) - [u"insert_id"]=> - int(0) - [u"num_rows"]=> - int(0) - [u"param_count"]=> - int(0) - [u"field_count"]=> - int(1) - [u"errno"]=> - int(0) - [u"error"]=> - unicode(0) "" - [u"sqlstate"]=> - unicode(5) "00000" - [u"id"]=> - int(1) -} bool(true) bool(true) ---- Row 1 diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index 989d977bd8..5e72c7decd 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -295,136 +295,136 @@ static uint mysqlnd_mbcharlen_ujis(uint ujis) /* {{{ mysqlnd_charsets */ const MYSQLND_CHARSET mysqlnd_charsets[] = { - { 1, "big5","big5_chinese_ci", 1, 2, mysqlnd_mbcharlen_big5, check_mb_big5}, - { 3, "dec8", "dec8_swedisch_ci", 1, 1, NULL, NULL}, - { 4, "cp850", "cp850_general_ci", 1, 1, NULL, NULL}, - { 6, "hp8", "hp8_english_ci", 1, 1, NULL, NULL}, - { 7, "koi8r", "koi8r_general_ci", 1, 1, NULL, NULL}, - { 8, "latin1", "latin1_swedish_ci", 1, 1, NULL, NULL}, - { 9, "latin2", "latin2_general_ci", 1, 1, NULL, NULL}, - { 10, "swe7", "swe7_swedish_ci", 1, 1, NULL, NULL}, - { 11, "ascii", "ascii_general_ci", 1, 1, NULL, NULL}, - { 12, "ujis", "ujis_japanese_ci", 1, 3, mysqlnd_mbcharlen_ujis, check_mb_ujis}, - { 13, "sjis", "sjis_japanese_ci", 1, 2, mysqlnd_mbcharlen_sjis, check_mb_sjis}, - { 16, "hebrew", "hebrew_general_ci", 1, 1, NULL, NULL}, - { 18, "tis620", "tis620_thai_ci", 1, 1, NULL, NULL}, - { 19, "euckr", "euckr_korean_ci", 1, 2, mysqlnd_mbcharlen_euckr, check_mb_euckr}, - { 22, "koi8u", "koi8u_general_ci", 1, 1, NULL, NULL}, - { 24, "gb2312", "gb2312_chinese_ci", 1, 2, mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, - { 25, "greek", "greek_general_ci", 1, 1, NULL, NULL}, - { 26, "cp1250", "cp1250_general_ci", 1, 1, NULL, NULL}, - { 28, "gbk", "gbk_chinese_ci", 1, 2, mysqlnd_mbcharlen_gbk, check_mb_gbk}, - { 30, "latin5", "latin5_turkish_ci", 1, 1, NULL, NULL}, - { 32, "armscii8", "armscii8_general_ci", 1, 1, NULL, NULL}, - { 33, "utf8", "utf8_general_ci", 1, 2, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 35, "ucs2", "ucs2_general_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 36, "cp866", "cp866_general_ci", 1, 1, NULL, NULL}, - { 37, "keybcs2", "keybcs2_general_ci", 1, 1, NULL, NULL}, - { 38, "macce", "macce_general_ci", 1, 1, NULL, NULL}, - { 39, "macroman", "macroman_general_ci", 1, 1, NULL, NULL}, - { 40, "cp852", "cp852_general_ci", 1, 1, NULL, NULL}, - { 41, "latin7", "latin7_general_ci", 1, 1, NULL, NULL}, - { 51, "cp1251", "cp1251_general_ci", 1, 1, NULL, NULL}, - { 57, "cp1256", "cp1256_general_ci", 1, 1, NULL, NULL}, - { 59, "cp1257", "cp1257_general_ci", 1, 1, NULL, NULL}, - { 63, "binary", "binary", 1, 1, NULL, NULL}, - { 92, "geostd8", "geostd8_general_ci", 1, 1, NULL, NULL}, - { 95, "cp932", "cp932_japanese_ci", 1, 2, mysqlnd_mbcharlen_cp932, check_mb_cp932}, - { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, - { 2, "latin2", "latin2_czech_cs", 1, 1, NULL, NULL}, - { 5, "latin1", "latin1_german_ci", 1, 1, NULL, NULL}, - { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, NULL, NULL}, - { 15, "latin1", "latin1_danish_ci", 1, 1, NULL, NULL}, - { 17, "filename", "filename", 1, 5, NULL, NULL}, - { 20, "latin7", "latin7_estonian_cs", 1, 1, NULL, NULL}, - { 21, "latin2", "latin2_hungarian_ci", 1, 1, NULL, NULL}, - { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, NULL, NULL}, - { 27, "latin2", "latin2_croatian_ci", 1, 1, NULL, NULL}, - { 29, "cp1257", "cp1257_lithunian_ci", 1, 1, NULL, NULL}, - { 31, "latin1", "latin1_german2_ci", 1, 1, NULL, NULL}, - { 34, "cp1250", "cp1250_czech_cs", 1, 1, NULL, NULL}, - { 42, "latin7", "latin7_general_cs", 1, 1, NULL, NULL}, - { 43, "macce", "macce_bin", 1, 1, NULL, NULL}, - { 44, "cp1250", "cp1250_croatian_ci", 1, 1, NULL, NULL}, - { 47, "latin1", "latin1_bin", 1, 1, NULL, NULL}, - { 48, "latin1", "latin1_general_ci", 1, 1, NULL, NULL}, - { 49, "latin1", "latin1_general_cs", 1, 1, NULL, NULL}, - { 50, "cp1251", "cp1251_bin", 1, 1, NULL, NULL}, - { 52, "cp1251", "cp1251_general_cs", 1, 1, NULL, NULL}, - { 53, "macroman", "macroman_bin", 1, 1, NULL, NULL}, - { 58, "cp1257", "cp1257_bin", 1, 1, NULL, NULL}, - { 60, "armascii8", "armascii8_bin", 1, 1, NULL, NULL}, - { 65, "ascii", "ascii_bin", 1, 1, NULL, NULL}, - { 66, "cp1250", "cp1250_bin", 1, 1, NULL, NULL}, - { 67, "cp1256", "cp1256_bin", 1, 1, NULL, NULL}, - { 68, "cp866", "cp866_bin", 1, 1, NULL, NULL}, - { 69, "dec8", "dec8_bin", 1, 1, NULL, NULL}, - { 70, "greek", "greek_bin", 1, 1, NULL, NULL}, - { 71, "hebew", "hebrew_bin", 1, 1, NULL, NULL}, - { 72, "hp8", "hp8_bin", 1, 1, NULL, NULL}, - { 73, "keybcs2", "keybcs2_bin", 1, 1, NULL, NULL}, - { 74, "koi8r", "koi8r_bin", 1, 1, NULL, NULL}, - { 75, "koi8u", "koi8u_bin", 1, 1, NULL, NULL}, - { 77, "latin2", "latin2_bin", 1, 1, NULL, NULL}, - { 78, "latin5", "latin5_bin", 1, 1, NULL, NULL}, - { 79, "latin7", "latin7_bin", 1, 1, NULL, NULL}, - { 80, "cp850", "cp850_bin", 1, 1, NULL, NULL}, - { 81, "cp852", "cp852_bin", 1, 1, NULL, NULL}, - { 82, "swe7", "swe7_bin", 1, 1, NULL, NULL}, - { 93, "geostd8", "geostd8_bin", 1, 1, NULL, NULL}, - { 83, "utf8", "utf8_bin", 1, 2, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 84, "big5", "big5_bin", 1, 2, mysqlnd_mbcharlen_big5, check_mb_big5}, - { 85, "euckr", "euckr_bin", 1, 2, mysqlnd_mbcharlen_euckr, check_mb_euckr}, - { 86, "gb2312", "gb2312_bin", 1, 2, mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, - { 87, "gbk", "gbk_bin", 1, 2, mysqlnd_mbcharlen_gbk, check_mb_gbk}, - { 88, "sjis", "sjis_bin", 1, 2, mysqlnd_mbcharlen_sjis, check_mb_sjis}, - { 89, "tis620", "tis620_bin", 1, 1, NULL, NULL}, - { 90, "ucs2", "ucs2_bin", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 91, "ujis", "ujis_bin", 1, 3, mysqlnd_mbcharlen_ujis, check_mb_ujis}, - { 94, "latin1", "latin1_spanish_ci", 1, 1, NULL, NULL}, - { 96, "cp932", "cp932_bin", 1, 2, mysqlnd_mbcharlen_cp932, check_mb_cp932}, - { 99, "cp1250", "cp1250_polish_ci", 1, 1, NULL, NULL}, - { 98, "eucjpms", "eucjpms_bin", 1, 3, mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, - { 128, "ucs2", "ucs2_unicode_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 129, "ucs2", "ucs2_icelandic_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 130, "ucs2", "ucs2_latvian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 131, "ucs2", "ucs2_romanian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 132, "ucs2", "ucs2_slovenian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 133, "ucs2", "ucs2_polish_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 134, "ucs2", "ucs2_estonian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 135, "ucs2", "ucs2_spanish_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 136, "ucs2", "ucs2_swedish_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 137, "ucs2", "ucs2_turkish_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 138, "ucs2", "ucs2_czech_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 139, "ucs2", "ucs2_danish_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 140, "ucs2", "ucs2_lithunian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 141, "ucs2", "ucs2_slovak_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 142, "ucs2", "ucs2_spanish2_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 143, "ucs2", "ucs2_roman_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 144, "ucs2", "ucs2_persian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 145, "ucs2", "ucs2_esperanto_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 146, "ucs2", "ucs2_hungarian_ci", 2, 2, mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, - { 192, "utf8", "utf8_general_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 193, "utf8", "utf8_icelandic_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 194, "utf8", "utf8_latvian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 195, "utf8", "utf8_romanian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 196, "utf8", "utf8_slovenian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 197, "utf8", "utf8_polish_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 198, "utf8", "utf8_estonian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 119, "utf8", "utf8_spanish_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 200, "utf8", "utf8_swedish_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 201, "utf8", "utf8_turkish_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 202, "utf8", "utf8_czech_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 203, "utf8", "utf8_danish_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid }, - { 204, "utf8", "utf8_lithunian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid }, - { 205, "utf8", "utf8_slovak_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 206, "utf8", "utf8_spanish2_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 207, "utf8", "utf8_roman_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 208, "utf8", "utf8_persian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 209, "utf8", "utf8_esperanto_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 210, "utf8", "utf8_hungarian_ci", 1, 3, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, - { 254, "utf8", "utf8_general_cs", 1, 2, mysqlnd_mbcharlen_utf8, check_mb_utf8_valid }, - { 0, NULL, NULL, 0, 0, NULL, NULL} + { 1, "big5","big5_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_big5, check_mb_big5}, + { 3, "dec8", "dec8_swedisch_ci", 1, 1, "", NULL, NULL}, + { 4, "cp850", "cp850_general_ci", 1, 1, "", NULL, NULL}, + { 6, "hp8", "hp8_english_ci", 1, 1, "", NULL, NULL}, + { 7, "koi8r", "koi8r_general_ci", 1, 1, "", NULL, NULL}, + { 8, "latin1", "latin1_swedish_ci", 1, 1, "", NULL, NULL}, + { 9, "latin2", "latin2_general_ci", 1, 1, "", NULL, NULL}, + { 10, "swe7", "swe7_swedish_ci", 1, 1, "", NULL, NULL}, + { 11, "ascii", "ascii_general_ci", 1, 1, "", NULL, NULL}, + { 12, "ujis", "ujis_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, + { 13, "sjis", "sjis_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_sjis, check_mb_sjis}, + { 16, "hebrew", "hebrew_general_ci", 1, 1, "", NULL, NULL}, + { 18, "tis620", "tis620_thai_ci", 1, 1, "", NULL, NULL}, + { 19, "euckr", "euckr_korean_ci", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, + { 22, "koi8u", "koi8u_general_ci", 1, 1, "", NULL, NULL}, + { 24, "gb2312", "gb2312_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, + { 25, "greek", "greek_general_ci", 1, 1, "", NULL, NULL}, + { 26, "cp1250", "cp1250_general_ci", 1, 1, "", NULL, NULL}, + { 28, "gbk", "gbk_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gbk, check_mb_gbk}, + { 30, "latin5", "latin5_turkish_ci", 1, 1, "", NULL, NULL}, + { 32, "armscii8", "armscii8_general_ci", 1, 1, "", NULL, NULL}, + { 33, "utf8", "utf8_general_ci", 1, 2, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 35, "ucs2", "ucs2_general_ci", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 36, "cp866", "cp866_general_ci", 1, 1, "", NULL, NULL}, + { 37, "keybcs2", "keybcs2_general_ci", 1, 1, "", NULL, NULL}, + { 38, "macce", "macce_general_ci", 1, 1, "", NULL, NULL}, + { 39, "macroman", "macroman_general_ci", 1, 1, "", NULL, NULL}, + { 40, "cp852", "cp852_general_ci", 1, 1, "", NULL, NULL}, + { 41, "latin7", "latin7_general_ci", 1, 1, "", NULL, NULL}, + { 51, "cp1251", "cp1251_general_ci", 1, 1, "", NULL, NULL}, + { 57, "cp1256", "cp1256_general_ci", 1, 1, "", NULL, NULL}, + { 59, "cp1257", "cp1257_general_ci", 1, 1, "", NULL, NULL}, + { 63, "binary", "binary", 1, 1, "", NULL, NULL}, + { 92, "geostd8", "geostd8_general_ci", 1, 1, "", NULL, NULL}, + { 95, "cp932", "cp932_japanese_ci", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, + { 97, "eucjpms", "eucjpms_japanese_ci", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, + { 2, "latin2", "latin2_czech_cs", 1, 1, "", NULL, NULL}, + { 5, "latin1", "latin1_german_ci", 1, 1, "", NULL, NULL}, + { 14, "cp1251", "cp1251_bulgarian_ci", 1, 1, "", NULL, NULL}, + { 15, "latin1", "latin1_danish_ci", 1, 1, "", NULL, NULL}, + { 17, "filename", "filename", 1, 5, "", NULL, NULL}, + { 20, "latin7", "latin7_estonian_cs", 1, 1, "", NULL, NULL}, + { 21, "latin2", "latin2_hungarian_ci", 1, 1, "", NULL, NULL}, + { 23, "cp1251", "cp1251_ukrainian_ci", 1, 1, "", NULL, NULL}, + { 27, "latin2", "latin2_croatian_ci", 1, 1, "", NULL, NULL}, + { 29, "cp1257", "cp1257_lithunian_ci", 1, 1, "", NULL, NULL}, + { 31, "latin1", "latin1_german2_ci", 1, 1, "", NULL, NULL}, + { 34, "cp1250", "cp1250_czech_cs", 1, 1, "", NULL, NULL}, + { 42, "latin7", "latin7_general_cs", 1, 1, "", NULL, NULL}, + { 43, "macce", "macce_bin", 1, 1, "", NULL, NULL}, + { 44, "cp1250", "cp1250_croatian_ci", 1, 1, "", NULL, NULL}, + { 47, "latin1", "latin1_bin", 1, 1, "", NULL, NULL}, + { 48, "latin1", "latin1_general_ci", 1, 1, "", NULL, NULL}, + { 49, "latin1", "latin1_general_cs", 1, 1, "", NULL, NULL}, + { 50, "cp1251", "cp1251_bin", 1, 1, "", NULL, NULL}, + { 52, "cp1251", "cp1251_general_cs", 1, 1, "", NULL, NULL}, + { 53, "macroman", "macroman_bin", 1, 1, "", NULL, NULL}, + { 58, "cp1257", "cp1257_bin", 1, 1, "", NULL, NULL}, + { 60, "armascii8", "armascii8_bin", 1, 1, "", NULL, NULL}, + { 65, "ascii", "ascii_bin", 1, 1, "", NULL, NULL}, + { 66, "cp1250", "cp1250_bin", 1, 1, "", NULL, NULL}, + { 67, "cp1256", "cp1256_bin", 1, 1, "", NULL, NULL}, + { 68, "cp866", "cp866_bin", 1, 1, "", NULL, NULL}, + { 69, "dec8", "dec8_bin", 1, 1, "", NULL, NULL}, + { 70, "greek", "greek_bin", 1, 1, "", NULL, NULL}, + { 71, "hebew", "hebrew_bin", 1, 1, "", NULL, NULL}, + { 72, "hp8", "hp8_bin", 1, 1, "", NULL, NULL}, + { 73, "keybcs2", "keybcs2_bin", 1, 1, "", NULL, NULL}, + { 74, "koi8r", "koi8r_bin", 1, 1, "", NULL, NULL}, + { 75, "koi8u", "koi8u_bin", 1, 1, "", NULL, NULL}, + { 77, "latin2", "latin2_bin", 1, 1, "", NULL, NULL}, + { 78, "latin5", "latin5_bin", 1, 1, "", NULL, NULL}, + { 79, "latin7", "latin7_bin", 1, 1, "", NULL, NULL}, + { 80, "cp850", "cp850_bin", 1, 1, "", NULL, NULL}, + { 81, "cp852", "cp852_bin", 1, 1, "", NULL, NULL}, + { 82, "swe7", "swe7_bin", 1, 1, "", NULL, NULL}, + { 93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL}, + { 83, "utf8", "utf8_bin", 1, 2, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 84, "big5", "big5_bin", 1, 2, "", mysqlnd_mbcharlen_big5, check_mb_big5}, + { 85, "euckr", "euckr_bin", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr}, + { 86, "gb2312", "gb2312_bin", 1, 2, "", mysqlnd_mbcharlen_gb2312, check_mb_gb2312}, + { 87, "gbk", "gbk_bin", 1, 2, "", mysqlnd_mbcharlen_gbk, check_mb_gbk}, + { 88, "sjis", "sjis_bin", 1, 2, "", mysqlnd_mbcharlen_sjis, check_mb_sjis}, + { 89, "tis620", "tis620_bin", 1, 1, "", NULL, NULL}, + { 90, "ucs2", "ucs2_bin", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 91, "ujis", "ujis_bin", 1, 3, "", mysqlnd_mbcharlen_ujis, check_mb_ujis}, + { 94, "latin1", "latin1_spanish_ci", 1, 1, "", NULL, NULL}, + { 96, "cp932", "cp932_bin", 1, 2, "", mysqlnd_mbcharlen_cp932, check_mb_cp932}, + { 99, "cp1250", "cp1250_polish_ci", 1, 1, "", NULL, NULL}, + { 98, "eucjpms", "eucjpms_bin", 1, 3, "", mysqlnd_mbcharlen_eucjpms, check_mb_eucjpms}, + { 128, "ucs2", "ucs2_unicode_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 129, "ucs2", "ucs2_icelandic_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 130, "ucs2", "ucs2_latvian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 131, "ucs2", "ucs2_romanian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 132, "ucs2", "ucs2_slovenian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 133, "ucs2", "ucs2_polish_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 134, "ucs2", "ucs2_estonian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 135, "ucs2", "ucs2_spanish_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 136, "ucs2", "ucs2_swedish_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 137, "ucs2", "ucs2_turkish_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 138, "ucs2", "ucs2_czech_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 139, "ucs2", "ucs2_danish_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 140, "ucs2", "ucs2_lithunian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 141, "ucs2", "ucs2_slovak_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 142, "ucs2", "ucs2_spanish2_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 143, "ucs2", "ucs2_roman_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 144, "ucs2", "ucs2_persian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 145, "ucs2", "ucs2_esperanto_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 146, "ucs2", "ucs2_hungarian_ci", 2, 2, "", mysqlnd_mbcharlen_ucs2, check_mb_ucs2}, + { 192, "utf8", "utf8_general_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 193, "utf8", "utf8_icelandic_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 194, "utf8", "utf8_latvian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 195, "utf8", "utf8_romanian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 196, "utf8", "utf8_slovenian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 197, "utf8", "utf8_polish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 198, "utf8", "utf8_estonian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 119, "utf8", "utf8_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 200, "utf8", "utf8_swedish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 201, "utf8", "utf8_turkish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 202, "utf8", "utf8_czech_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 203, "utf8", "utf8_danish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid }, + { 204, "utf8", "utf8_lithunian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid }, + { 205, "utf8", "utf8_slovak_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 206, "utf8", "utf8_spanish2_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 207, "utf8", "utf8_roman_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 208, "utf8", "utf8_persian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 209, "utf8", "utf8_esperanto_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 210, "utf8", "utf8_hungarian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 254, "utf8", "utf8_general_cs", 1, 2, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid}, + { 0, NULL, NULL, 0, 0, NULL, NULL, NULL} }; /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index d6b98d018c..7679b72169 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -297,9 +297,7 @@ mysqlnd_stmt_read_prepare_response(MYSQLND_STMT *stmt TSRMLS_DC) stmt->stmt_id = prepare_resp.stmt_id; stmt->warning_count = stmt->conn->upsert_status.warning_count = prepare_resp.warning_count; - stmt->upsert_status.affected_rows = 0; - stmt->field_count = prepare_resp.field_count; - stmt->conn->field_count = 0; + stmt->field_count = stmt->conn->field_count = prepare_resp.field_count; stmt->param_count = prepare_resp.param_count; PACKET_FREE_ALLOCA(prepare_resp); diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 5da7bd2bb9..334eef8061 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -124,13 +124,14 @@ typedef struct st_mysqlnd_infile_info /* character set information */ typedef struct st_mysqlnd_charset { - uint nr; - char *name; - char *collation; - uint char_minlen; - uint char_maxlen; - uint (*mb_charlen)(uint c); - uint (*mb_valid)(const char *start, const char *end); + uint nr; + const char *name; + const char *collation; + uint char_minlen; + uint char_maxlen; + const char *comment; + uint (*mb_charlen)(uint c); + uint (*mb_valid)(const char *start, const char *end); } MYSQLND_CHARSET;