mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
This commit is contained in:
@@ -109,15 +109,6 @@ static bool convert_constant_item(Field *field, Item **item)
|
||||
}
|
||||
|
||||
|
||||
bool Item_bool_func2::fix_fields(THD *thd, struct st_table_list *tables,
|
||||
Item ** ref)
|
||||
{
|
||||
if (Item_int_func::fix_fields(thd, tables, ref))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
max_length= 1; // Function returns 0 or 1
|
||||
@@ -191,8 +182,6 @@ void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
|
||||
INT_RESULT); // Works for all types.
|
||||
cmp_collation.set(&my_charset_bin,
|
||||
DERIVATION_NONE); // For test in fix_fields
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -206,23 +195,11 @@ void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
cmp.set_cmp_func(this, tmp_arg, tmp_arg+1,
|
||||
INT_RESULT); // Works for all types.
|
||||
cmp_collation.set(&my_charset_bin,
|
||||
DERIVATION_NONE); // For test in fix_fields
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
set_cmp_func();
|
||||
/*
|
||||
We must set cmp_charset here as we may be called from for an automatic
|
||||
generated item, like in natural join
|
||||
*/
|
||||
if (cmp_collation.set(args[0]->collation, args[1]->collation))
|
||||
{
|
||||
/* set_cmp_charset() failed */
|
||||
my_coll_agg_error(args[0]->collation, args[1]->collation, func_name());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +229,18 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
||||
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
||||
}
|
||||
}
|
||||
else if (type == STRING_RESULT)
|
||||
{
|
||||
/*
|
||||
We must set cmp_charset here as we may be called from for an automatic
|
||||
generated item, like in natural join
|
||||
*/
|
||||
if (cmp_collation.set((*a)->collation, (*b)->collation))
|
||||
{
|
||||
my_coll_agg_error((*a)->collation, (*b)->collation, owner->func_name());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -264,7 +253,7 @@ int Arg_comparator::compare_string()
|
||||
if ((res2= (*b)->val_str(&owner->tmp_value2)))
|
||||
{
|
||||
owner->null_value= 0;
|
||||
return sortcmp(res1,res2,owner->cmp_collation.collation);
|
||||
return sortcmp(res1,res2,cmp_collation.collation);
|
||||
}
|
||||
}
|
||||
owner->null_value= 1;
|
||||
@@ -278,7 +267,7 @@ int Arg_comparator::compare_e_string()
|
||||
res2= (*b)->val_str(&owner->tmp_value2);
|
||||
if (!res1 || !res2)
|
||||
return test(res1 == res2);
|
||||
return test(sortcmp(res1, res2, owner->cmp_collation.collation) == 0);
|
||||
return test(sortcmp(res1, res2, cmp_collation.collation) == 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -502,7 +491,7 @@ longlong Item_func_strcmp::val_int()
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
int value= sortcmp(a,b,cmp_collation.collation);
|
||||
int value= sortcmp(a,b,cmp.cmp_collation.collation);
|
||||
null_value=0;
|
||||
return !value ? 0 : (value < 0 ? (longlong) -1 : (longlong) 1);
|
||||
}
|
||||
@@ -1893,7 +1882,7 @@ longlong Item_func_like::val_int()
|
||||
null_value=0;
|
||||
if (canDoTurboBM)
|
||||
return turboBM_matches(res->ptr(), res->length()) ? 1 : 0;
|
||||
return my_wildcmp(cmp_collation.collation,
|
||||
return my_wildcmp(cmp.cmp_collation.collation,
|
||||
res->ptr(),res->ptr()+res->length(),
|
||||
res2->ptr(),res2->ptr()+res2->length(),
|
||||
escape,wild_one,wild_many) ? 0 : 1;
|
||||
@@ -2103,7 +2092,7 @@ void Item_func_like::turboBM_compute_suffixes(int *suff)
|
||||
|
||||
*splm1 = pattern_len;
|
||||
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
int i;
|
||||
for (i = pattern_len - 2; i >= 0; i--)
|
||||
@@ -2206,7 +2195,7 @@ void Item_func_like::turboBM_compute_bad_character_shifts()
|
||||
for (i = bmBc; i < end; i++)
|
||||
*i = pattern_len;
|
||||
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
for (j = 0; j < plm1; j++)
|
||||
bmBc[(uint) (uchar) pattern[j]] = plm1 - j;
|
||||
@@ -2237,7 +2226,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
|
||||
const int tlmpl= text_len - pattern_len;
|
||||
|
||||
/* Searching */
|
||||
if (cmp_collation.collation == &my_charset_bin)
|
||||
if (cmp.cmp_collation.collation == &my_charset_bin)
|
||||
{
|
||||
while (j <= tlmpl)
|
||||
{
|
||||
|
@@ -35,6 +35,8 @@ class Arg_comparator: public Sql_alloc
|
||||
Arg_comparator *comparators; // used only for compare_row()
|
||||
|
||||
public:
|
||||
DTCollation cmp_collation;
|
||||
|
||||
Arg_comparator() {};
|
||||
Arg_comparator(Item **a1, Item **a2): a(a1), b(a2) {};
|
||||
|
||||
@@ -112,13 +114,10 @@ class Item_bool_func2 :public Item_int_func
|
||||
protected:
|
||||
Arg_comparator cmp;
|
||||
String tmp_value1,tmp_value2;
|
||||
DTCollation cmp_collation;
|
||||
|
||||
public:
|
||||
Item_bool_func2(Item *a,Item *b):
|
||||
Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1)
|
||||
{ cmp_collation.set(0,DERIVATION_NONE);}
|
||||
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref);
|
||||
Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1) {}
|
||||
void fix_length_and_dec();
|
||||
void set_cmp_func()
|
||||
{
|
||||
|
Reference in New Issue
Block a user