Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-alloc_group-4.1
This commit is contained in:
commit
17f13a4a79
@ -23,7 +23,6 @@
|
|||||||
#include "mysql.h"
|
#include "mysql.h"
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
#include <dbug.h>
|
|
||||||
|
|
||||||
#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
|
#if defined(HAVE_BROKEN_GETPASS) && !defined(HAVE_GETPASSPHRASE)
|
||||||
#undef HAVE_GETPASS
|
#undef HAVE_GETPASS
|
||||||
|
@ -50,7 +50,13 @@ Item::Item():
|
|||||||
next= thd->free_list; // Put in free list
|
next= thd->free_list; // Put in free list
|
||||||
thd->free_list= this;
|
thd->free_list= this;
|
||||||
loop_id= 0;
|
loop_id= 0;
|
||||||
if (thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST)
|
/*
|
||||||
|
Item constructor can be called during execution other tnen SQL_COM
|
||||||
|
command => we should check thd->lex.current_select on zero (thd->lex
|
||||||
|
can be uninitialised)
|
||||||
|
*/
|
||||||
|
if (thd->lex.current_select &&
|
||||||
|
thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST)
|
||||||
thd->lex.current_select->select_items++;
|
thd->lex.current_select->select_items++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,9 +185,6 @@ public:
|
|||||||
collation.collation= collation_arg->collation;
|
collation.collation= collation_arg->collation;
|
||||||
collation.derivation= collation_arg->derivation;
|
collation.derivation= collation_arg->derivation;
|
||||||
}
|
}
|
||||||
bool binary() const
|
|
||||||
{ return charset()->state & MY_CS_BINSORT ? 1 : 0 ; }
|
|
||||||
|
|
||||||
virtual void set_outer_resolving() {}
|
virtual void set_outer_resolving() {}
|
||||||
|
|
||||||
// Row emulation
|
// Row emulation
|
||||||
|
@ -380,12 +380,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
|
|||||||
return 1;
|
return 1;
|
||||||
if (args[0]->maybe_null)
|
if (args[0]->maybe_null)
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
/*
|
|
||||||
TODO: Check if following is right
|
|
||||||
(set_charset set type of result, not how compare should be used)
|
|
||||||
*/
|
|
||||||
if (args[0]->binary())
|
|
||||||
set_charset(&my_charset_bin);
|
|
||||||
with_sum_func= args[0]->with_sum_func;
|
with_sum_func= args[0]->with_sum_func;
|
||||||
used_tables_cache= args[0]->used_tables();
|
used_tables_cache= args[0]->used_tables();
|
||||||
const_item_cache= args[0]->const_item();
|
const_item_cache= args[0]->const_item();
|
||||||
@ -933,7 +928,7 @@ Item *Item_func_case::find_item(String *str)
|
|||||||
if ((tmp=args[i]->val_str(str))) // If not null
|
if ((tmp=args[i]->val_str(str))) // If not null
|
||||||
{
|
{
|
||||||
/* QQ: COERCIBILITY */
|
/* QQ: COERCIBILITY */
|
||||||
if (first_expr_is_binary || args[i]->binary())
|
if (first_expr_is_binary || (args[i]->charset()->state & MY_CS_BINSORT))
|
||||||
{
|
{
|
||||||
if (sortcmp(tmp,first_expr_str,&my_charset_bin)==0)
|
if (sortcmp(tmp,first_expr_str,&my_charset_bin)==0)
|
||||||
return args[i+1];
|
return args[i+1];
|
||||||
@ -1044,7 +1039,7 @@ Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
used_tables_cache|=(first_expr)->used_tables();
|
used_tables_cache|=(first_expr)->used_tables();
|
||||||
const_item_cache&= (first_expr)->const_item();
|
const_item_cache&= (first_expr)->const_item();
|
||||||
with_sum_func= with_sum_func || (first_expr)->with_sum_func;
|
with_sum_func= with_sum_func || (first_expr)->with_sum_func;
|
||||||
first_expr_is_binary= first_expr->binary();
|
first_expr_is_binary= first_expr->charset()->state & MY_CS_BINSORT;
|
||||||
}
|
}
|
||||||
if (else_expr)
|
if (else_expr)
|
||||||
{
|
{
|
||||||
|
@ -129,8 +129,6 @@ public:
|
|||||||
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
|
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
|
||||||
void print(String *str) { Item_func::print_op(str); }
|
void print(String *str) { Item_func::print_op(str); }
|
||||||
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
|
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
|
||||||
virtual bool binary() const
|
|
||||||
{ return test(cmp_collation.collation->state & MY_CS_BINSORT); }
|
|
||||||
|
|
||||||
static Item_bool_func2* eq_creator(Item *a, Item *b);
|
static Item_bool_func2* eq_creator(Item *a, Item *b);
|
||||||
static Item_bool_func2* ne_creator(Item *a, Item *b);
|
static Item_bool_func2* ne_creator(Item *a, Item *b);
|
||||||
|
@ -1353,7 +1353,18 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||||||
Item *item= *arg;
|
Item *item= *arg;
|
||||||
if (item->fix_fields(thd, tables, arg) || item->check_cols(1))
|
if (item->fix_fields(thd, tables, arg) || item->check_cols(1))
|
||||||
return 1;
|
return 1;
|
||||||
if (item->binary())
|
/*
|
||||||
|
TODO: We should think about this. It is not always
|
||||||
|
right way just to set an UDF result to return my_charset_bin
|
||||||
|
if one argument has binary sorting order.
|
||||||
|
The result collation should be calculated according to arguments
|
||||||
|
derivations in some cases and should not in other cases.
|
||||||
|
Moreover, some arguments can represent a numeric input
|
||||||
|
which doesn't effect the result character set and collation.
|
||||||
|
There is no a general rule for UDF. Everything depends on
|
||||||
|
the particular user definted function.
|
||||||
|
*/
|
||||||
|
if (item->charset()->state & MY_CS_BINSORT)
|
||||||
func->set_charset(&my_charset_bin);
|
func->set_charset(&my_charset_bin);
|
||||||
if (item->maybe_null)
|
if (item->maybe_null)
|
||||||
func->maybe_null=1;
|
func->maybe_null=1;
|
||||||
|
@ -748,7 +748,7 @@ String *Item_func_replace::val_str(String *str)
|
|||||||
res->set_charset(collation.collation);
|
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 = ((res->charset()->state & MY_CS_BINSORT) || !use_mb(res->charset()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (res2->length() == 0)
|
if (res2->length() == 0)
|
||||||
|
@ -44,12 +44,6 @@ int sortcmp2(void* cmp_arg __attribute__((unused)),
|
|||||||
return sortcmp(a,b,a->charset());
|
return sortcmp(a,b,a->charset());
|
||||||
}
|
}
|
||||||
|
|
||||||
int stringcmp2(void* cmp_arg __attribute__((unused)),
|
|
||||||
const String *a,const String *b)
|
|
||||||
{
|
|
||||||
return sortcmp(a,b,&my_charset_bin);
|
|
||||||
}
|
|
||||||
|
|
||||||
int compare_double2(void* cmp_arg __attribute__((unused)),
|
int compare_double2(void* cmp_arg __attribute__((unused)),
|
||||||
const double *s, const double *t)
|
const double *s, const double *t)
|
||||||
{
|
{
|
||||||
|
@ -99,8 +99,6 @@ int collect_string(String *element, element_count count,
|
|||||||
|
|
||||||
int sortcmp2(void* cmp_arg __attribute__((unused)),
|
int sortcmp2(void* cmp_arg __attribute__((unused)),
|
||||||
const String *a,const String *b);
|
const String *a,const String *b);
|
||||||
int stringcmp2(void* cmp_arg __attribute__((unused)),
|
|
||||||
const String *a,const String *b);
|
|
||||||
|
|
||||||
class field_str :public field_info
|
class field_str :public field_info
|
||||||
{
|
{
|
||||||
@ -117,8 +115,7 @@ public:
|
|||||||
max_arg("",default_charset_info), sum(0),
|
max_arg("",default_charset_info), sum(0),
|
||||||
must_be_blob(0), was_zero_fill(0),
|
must_be_blob(0), was_zero_fill(0),
|
||||||
was_maybe_zerofill(0), can_be_still_num(1)
|
was_maybe_zerofill(0), can_be_still_num(1)
|
||||||
{ init_tree(&tree, 0, 0, sizeof(String), a->binary() ?
|
{ init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2,
|
||||||
(qsort_cmp2) stringcmp2 : (qsort_cmp2) sortcmp2,
|
|
||||||
0, (tree_element_free) free_string, NULL); };
|
0, (tree_element_free) free_string, NULL); };
|
||||||
|
|
||||||
void add();
|
void add();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user