diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-06-26 15:45:04 +0500 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-06-26 15:45:04 +0500 |
commit | 1d29092e2dded4d0081932759944de0e5ea3c2a6 (patch) | |
tree | b12f7a29d20314fcc739b16e3cc5822b665a165d /sql | |
parent | 11e9c572ad1d81536902dd01d48c68ef00ce9018 (diff) | |
download | mariadb-git-1d29092e2dded4d0081932759944de0e5ea3c2a6.tar.gz |
New messages for 3-adic and N-adic operations
REPLACE() now processed arguments collations according to standard
Diffstat (limited to 'sql')
27 files changed, 82 insertions, 20 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 52bd14ed515..ca3f55a9804 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -26,7 +26,7 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { - my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0), + my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), c1.collation->name,c1.derivation_name(), c2.collation->name,c2.derivation_name(), fname); @@ -1968,7 +1968,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func; max_length= 1; decimals= 0; - binary_cmp= (args[0]->binary() || args[1]->binary()); + + if (cmp_collation.set(args[0]->collation, args[1]->collation)) + { + my_coll_agg_error(args[0]->collation, args[1]->collation, func_name()); + return 1; + } used_tables_cache=args[0]->used_tables() | args[1]->used_tables(); const_item_cache=args[0]->const_item() && args[1]->const_item(); @@ -1984,9 +1989,10 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) } int error; if ((error=regcomp(&preg,res->c_ptr(), - binary_cmp ? REG_EXTENDED | REG_NOSUB : + (cmp_collation.collation->state & MY_CS_BINSORT) ? + REG_EXTENDED | REG_NOSUB : REG_EXTENDED | REG_NOSUB | REG_ICASE, - res->charset()))) + cmp_collation.collation))) { (void) regerror(error,&preg,buff,sizeof(buff)); my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff); @@ -2033,10 +2039,10 @@ longlong Item_func_regex::val_int() regex_compiled=0; } if (regcomp(&preg,res2->c_ptr(), - binary_cmp ? REG_EXTENDED | REG_NOSUB : + (cmp_collation.collation->state & MY_CS_BINSORT) ? + REG_EXTENDED | REG_NOSUB : REG_EXTENDED | REG_NOSUB | REG_ICASE, - res->charset())) - + cmp_collation.collation)) { null_value=1; return 0; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 70e477402d9..1221e316a72 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -747,7 +747,7 @@ class Item_func_regex :public Item_bool_func bool regex_compiled; bool regex_is_const; String prev_regexp; - bool binary_cmp; + DTCollation cmp_collation; public: Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b), regex_compiled(0),regex_is_const(0) {} diff --git a/sql/item_func.cc b/sql/item_func.cc index cabffdfc7c2..d7237f55522 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -33,7 +33,7 @@ static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { - my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0), + my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), c1.collation->name,c1.derivation_name(), c2.collation->name,c2.derivation_name(), fname); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a57800c89d1..ae63ac85d4d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -38,12 +38,24 @@ String empty_string("",default_charset_info); static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) { - my_error(ER_CANT_AGGREGATE_COLLATIONS,MYF(0), + my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), c1.collation->name,c1.derivation_name(), c2.collation->name,c2.derivation_name(), fname); } +static void my_coll_agg3_error(DTCollation &c1, + DTCollation &c2, + DTCollation &c3, + const char *fname) +{ + my_error(ER_CANT_AGGREGATE_3COLLATIONS,MYF(0), + c1.collation->name,c1.derivation_name(), + c2.collation->name,c2.derivation_name(), + c3.collation->name,c3.derivation_name(), + fname); +} + uint nr_of_decimals(const char *str) { if ((str=strchr(str,'.'))) @@ -733,6 +745,8 @@ String *Item_func_replace::val_str(String *str) if (args[1]->null_value) goto null; + res->set_charset(collation.collation); + #ifdef USE_MB binary_cmp = (args[0]->binary() || args[1]->binary() || !use_mb(res->charset())); #endif @@ -813,7 +827,6 @@ null: void Item_func_replace::fix_length_and_dec() { - uint i; max_length=args[0]->max_length; int diff=(int) (args[2]->max_length - args[1]->max_length); if (diff > 0 && args[1]->max_length) @@ -828,14 +841,12 @@ void Item_func_replace::fix_length_and_dec() } collation.set(args[0]->collation); - for (i=1; i<3; i++) - { - if (collation.aggregate(args[i]->collation)) - { - my_coll_agg_error(collation, args[i]->collation, func_name()); - break; - } - } + if (!collation.aggregate(args[1]->collation)) + collation.aggregate(args[2]->collation); + + if (collation.derivation == DERIVATION_NONE) + my_coll_agg3_error(args[0]->collation, args[1]->collation, + args[2]->collation, func_name()); } @@ -931,7 +942,6 @@ String *Item_func_left::val_str(String *str) if (!res->alloced_length()) { // Don't change const str str_value= *res; // Not malloced string - set_charset(res->charset()); res= &str_value; } res->length((uint) length); diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 273dfa0fcf5..190d208a033 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -273,3 +273,5 @@ v/* "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 1d39a328154..909f69617a0 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -267,3 +267,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 5b79f06b621..8d8da1840fb 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -275,3 +275,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index f15e063c487..9e22377ce77 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -269,3 +269,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 506b5fc0188..c3b5fa7a2ec 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -269,3 +269,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 8882e4dceda..6c34663021c 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -264,3 +264,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 1e8f5bb2c05..2741d1e5a25 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -273,3 +273,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index d322f3fbd6a..b643e465846 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -264,3 +264,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 162bfc5509c..86fbb4dce6f 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -266,3 +266,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 26d916a968d..71c5d7f2c95 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -264,3 +264,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index a01a2b7ff6f..a9aa0747a59 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -266,3 +266,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 5f5526be04b..a6cf0a35dd0 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -264,3 +264,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index bf1019d3d87..062fd8dd8f7 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -266,3 +266,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 68c95bbf22b..d5268237ee4 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -266,3 +266,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 5b93403c757..e6861f7f8bb 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -268,3 +268,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index edd3e3b813f..f389084514b 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -264,3 +264,5 @@ "Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 873a708fa7b..32b0e0bcd03 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -268,3 +268,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index a05ecde6808..d8c5cac08d5 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -266,3 +266,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index c1c0de779c7..40a2e4cac95 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -260,3 +260,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 26d673b847c..9f3cc7ce877 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -272,3 +272,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 99a92f63c4e..56d246b9032 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -265,3 +265,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index c613d205947..84b648f5eca 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -264,3 +264,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 6505c3c9cac..1d46b125c8c 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -269,3 +269,5 @@ "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Can't drop one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users" +"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", +"Illegal mix of collations for operation '%s'", |