Commit 1d29092e authored by unknown's avatar unknown

New messages for 3-adic and N-adic operations

REPLACE() now processed arguments collations according to standard

parent 11e9c572
...@@ -281,7 +281,9 @@ ...@@ -281,7 +281,9 @@
#define ER_WARN_DATA_OUT_OF_RANGE 1262 #define ER_WARN_DATA_OUT_OF_RANGE 1262
#define ER_WARN_DATA_TRUNCATED 1263 #define ER_WARN_DATA_TRUNCATED 1263
#define ER_WARN_USING_OTHER_HANDLER 1264 #define ER_WARN_USING_OTHER_HANDLER 1264
#define ER_CANT_AGGREGATE_COLLATIONS 1265 #define ER_CANT_AGGREGATE_2COLLATIONS 1265
#define ER_DROP_USER 1266 #define ER_DROP_USER 1266
#define ER_REVOKE_GRANTS 1267 #define ER_REVOKE_GRANTS 1267
#define ER_ERROR_MESSAGES 266 #define ER_CANT_AGGREGATE_3COLLATIONS 1268
#define ER_CANT_AGGREGATE_NCOLLATIONS 1269
#define ER_ERROR_MESSAGES 270
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) 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(), c1.collation->name,c1.derivation_name(),
c2.collation->name,c2.derivation_name(), c2.collation->name,c2.derivation_name(),
fname); fname);
...@@ -1968,7 +1968,12 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) ...@@ -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; with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
max_length= 1; max_length= 1;
decimals= 0; 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(); used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
const_item_cache=args[0]->const_item() && args[1]->const_item(); 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) ...@@ -1984,9 +1989,10 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
} }
int error; int error;
if ((error=regcomp(&preg,res->c_ptr(), 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, REG_EXTENDED | REG_NOSUB | REG_ICASE,
res->charset()))) cmp_collation.collation)))
{ {
(void) regerror(error,&preg,buff,sizeof(buff)); (void) regerror(error,&preg,buff,sizeof(buff));
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff); my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff);
...@@ -2033,10 +2039,10 @@ longlong Item_func_regex::val_int() ...@@ -2033,10 +2039,10 @@ longlong Item_func_regex::val_int()
regex_compiled=0; regex_compiled=0;
} }
if (regcomp(&preg,res2->c_ptr(), 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, REG_EXTENDED | REG_NOSUB | REG_ICASE,
res->charset())) cmp_collation.collation))
{ {
null_value=1; null_value=1;
return 0; return 0;
......
...@@ -747,7 +747,7 @@ class Item_func_regex :public Item_bool_func ...@@ -747,7 +747,7 @@ class Item_func_regex :public Item_bool_func
bool regex_compiled; bool regex_compiled;
bool regex_is_const; bool regex_is_const;
String prev_regexp; String prev_regexp;
bool binary_cmp; DTCollation cmp_collation;
public: public:
Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b), Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
regex_compiled(0),regex_is_const(0) {} regex_compiled(0),regex_is_const(0) {}
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) 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(), c1.collation->name,c1.derivation_name(),
c2.collation->name,c2.derivation_name(), c2.collation->name,c2.derivation_name(),
fname); fname);
......
...@@ -38,12 +38,24 @@ String empty_string("",default_charset_info); ...@@ -38,12 +38,24 @@ String empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) 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(), c1.collation->name,c1.derivation_name(),
c2.collation->name,c2.derivation_name(), c2.collation->name,c2.derivation_name(),
fname); 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) uint nr_of_decimals(const char *str)
{ {
if ((str=strchr(str,'.'))) if ((str=strchr(str,'.')))
...@@ -733,6 +745,8 @@ String *Item_func_replace::val_str(String *str) ...@@ -733,6 +745,8 @@ String *Item_func_replace::val_str(String *str)
if (args[1]->null_value) if (args[1]->null_value)
goto null; goto null;
res->set_charset(collation.collation);
#ifdef USE_MB #ifdef USE_MB
binary_cmp = (args[0]->binary() || args[1]->binary() || !use_mb(res->charset())); binary_cmp = (args[0]->binary() || args[1]->binary() || !use_mb(res->charset()));
#endif #endif
...@@ -813,7 +827,6 @@ String *Item_func_replace::val_str(String *str) ...@@ -813,7 +827,6 @@ String *Item_func_replace::val_str(String *str)
void Item_func_replace::fix_length_and_dec() void Item_func_replace::fix_length_and_dec()
{ {
uint i;
max_length=args[0]->max_length; max_length=args[0]->max_length;
int diff=(int) (args[2]->max_length - args[1]->max_length); int diff=(int) (args[2]->max_length - args[1]->max_length);
if (diff > 0 && args[1]->max_length) if (diff > 0 && args[1]->max_length)
...@@ -828,14 +841,12 @@ void Item_func_replace::fix_length_and_dec() ...@@ -828,14 +841,12 @@ void Item_func_replace::fix_length_and_dec()
} }
collation.set(args[0]->collation); collation.set(args[0]->collation);
for (i=1; i<3; i++) if (!collation.aggregate(args[1]->collation))
{ collation.aggregate(args[2]->collation);
if (collation.aggregate(args[i]->collation))
{ if (collation.derivation == DERIVATION_NONE)
my_coll_agg_error(collation, args[i]->collation, func_name()); my_coll_agg3_error(args[0]->collation, args[1]->collation,
break; args[2]->collation, func_name());
}
}
} }
...@@ -931,7 +942,6 @@ String *Item_func_left::val_str(String *str) ...@@ -931,7 +942,6 @@ String *Item_func_left::val_str(String *str)
if (!res->alloced_length()) if (!res->alloced_length())
{ // Don't change const str { // Don't change const str
str_value= *res; // Not malloced string str_value= *res; // Not malloced string
set_charset(res->charset());
res= &str_value; res= &str_value;
} }
res->length((uint) length); res->length((uint) length);
......
...@@ -273,3 +273,5 @@ v/* ...@@ -273,3 +273,5 @@ v/*
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -267,3 +267,5 @@ ...@@ -267,3 +267,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -275,3 +275,5 @@ ...@@ -275,3 +275,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -269,3 +269,5 @@ ...@@ -269,3 +269,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -269,3 +269,5 @@ ...@@ -269,3 +269,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -273,3 +273,5 @@ ...@@ -273,3 +273,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -266,3 +266,5 @@ ...@@ -266,3 +266,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -266,3 +266,5 @@ ...@@ -266,3 +266,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -266,3 +266,5 @@ ...@@ -266,3 +266,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -266,3 +266,5 @@ ...@@ -266,3 +266,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -268,3 +268,5 @@ ...@@ -268,3 +268,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'", "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 drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -268,3 +268,5 @@ ...@@ -268,3 +268,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -266,3 +266,5 @@ ...@@ -266,3 +266,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -260,3 +260,5 @@ ...@@ -260,3 +260,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -272,3 +272,5 @@ ...@@ -272,3 +272,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -265,3 +265,5 @@ ...@@ -265,3 +265,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -264,3 +264,5 @@ ...@@ -264,3 +264,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
...@@ -269,3 +269,5 @@ ...@@ -269,3 +269,5 @@
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users"
"Can't revoke all privileges, grant for 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'",
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment