diff options
author | unknown <gluh@eagle.(none)> | 2007-10-16 13:19:01 +0500 |
---|---|---|
committer | unknown <gluh@eagle.(none)> | 2007-10-16 13:19:01 +0500 |
commit | 55a3a64eb1f971f40c9c1cb4068f2b15eeec8bb9 (patch) | |
tree | 1be6661e0b402cfbe41f506836d9a4534381ed33 | |
parent | 9bb3c7ebdd1a4b2d2cbe08917402af40b0f998a8 (diff) | |
parent | 048006e2f9a4cc0ffd39eb160c6810ae84e78328 (diff) | |
download | mariadb-git-55a3a64eb1f971f40c9c1cb4068f2b15eeec8bb9.tar.gz |
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt
sql/item.cc:
Auto merged
sql/item.h:
manual merge
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 40 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 8 | ||||
-rw-r--r-- | sql/item.cc | 12 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 15 |
5 files changed, 31 insertions, 46 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index a86dfbc190d..4a15da71ee2 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1742,25 +1742,13 @@ NULL Warnings: Error 1300 Invalid utf8 character string: 'FF' select hex(_utf8 0x616263FF); -hex(_utf8 0x616263FF) -NULL -Warnings: -Error 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 X'616263FF'); -hex(_utf8 X'616263FF') -NULL -Warnings: -Error 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 B'001111111111'); -hex(_utf8 B'001111111111') -NULL -Warnings: -Error 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select (_utf8 X'616263FF'); -(_utf8 X'616263FF') -NULL -Warnings: -Error 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' set sql_mode=default; select hex(char(0xFF using utf8)); hex(char(0xFF using utf8)) @@ -1773,22 +1761,10 @@ hex(convert(0xFF using utf8)) Warnings: Warning 1300 Invalid utf8 character string: 'FF' select hex(_utf8 0x616263FF); -hex(_utf8 0x616263FF) -616263 -Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 X'616263FF'); -hex(_utf8 X'616263FF') -616263 -Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select hex(_utf8 B'001111111111'); -hex(_utf8 B'001111111111') -03 -Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' select (_utf8 X'616263FF'); -(_utf8 X'616263FF') -abc -Warnings: -Warning 1300 Invalid utf8 character string: 'FF' +ERROR HY000: Invalid utf8 character string: 'FF' diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index e10fb708f5c..0ae4b2be0ca 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1411,14 +1411,22 @@ DROP TABLE t1, t2; set sql_mode=traditional; select hex(char(0xFF using utf8)); select hex(convert(0xFF using utf8)); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 0x616263FF); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 X'616263FF'); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 B'001111111111'); +--error ER_INVALID_CHARACTER_STRING select (_utf8 X'616263FF'); set sql_mode=default; select hex(char(0xFF using utf8)); select hex(convert(0xFF using utf8)); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 0x616263FF); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 X'616263FF'); +--error ER_INVALID_CHARACTER_STRING select hex(_utf8 B'001111111111'); +--error ER_INVALID_CHARACTER_STRING select (_utf8 X'616263FF'); diff --git a/sql/item.cc b/sql/item.cc index d1a847afe03..3177c0fb1e8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4247,7 +4247,7 @@ bool Item::is_datetime() } -String *Item::check_well_formed_result(String *str) +String *Item::check_well_formed_result(String *str, bool send_error) { /* Check whether we got a well-formed string */ CHARSET_INFO *cs= str->charset(); @@ -4263,8 +4263,14 @@ String *Item::check_well_formed_result(String *str) uint diff= str->length() - wlen; set_if_smaller(diff, 3); octet2hex(hexbuf, str->ptr() + wlen, diff); - if (thd->variables.sql_mode & - (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)) + if (send_error) + { + my_error(ER_INVALID_CHARACTER_STRING, MYF(0), + cs->csname, hexbuf); + return 0; + } + if ((thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { level= MYSQL_ERROR::WARN_LEVEL_ERROR; null_value= 1; diff --git a/sql/item.h b/sql/item.h index f4f3753d655..913dca50bff 100644 --- a/sql/item.h +++ b/sql/item.h @@ -872,7 +872,7 @@ public: bool is_datetime(); virtual Field::geometry_type get_geometry_type() const { return Field::GEOM_GEOMETRY; }; - String *check_well_formed_result(String *str); + String *check_well_formed_result(String *str, bool send_error= 0); }; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c651c5b1f64..82100b3d3dd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7720,15 +7720,11 @@ literal: str ? str->ptr() : "", str ? str->length() : 0, Lex->underscore_charset); - if ($$) + if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) { - ((Item_string *) $$)->set_repertoire_from_value(); - if (!$$->check_well_formed_result(&$$->str_value)) - { - $$= new Item_null(); - $$->set_name(NULL, 0, system_charset_info); - } + MYSQL_YYABORT; } + ((Item_string *) $$)->set_repertoire_from_value(); } | UNDERSCORE_CHARSET BIN_NUM { @@ -7744,10 +7740,9 @@ literal: str ? str->ptr() : "", str ? str->length() : 0, Lex->underscore_charset); - if ($$ && !$$->check_well_formed_result(&$$->str_value)) + if (!$$ || !$$->check_well_formed_result(&$$->str_value, TRUE)) { - $$= new Item_null(); - $$->set_name(NULL, 0, system_charset_info); + MYSQL_YYABORT; } } | DATE_SYM text_literal { $$ = $2; } |