mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 13:15:32 +02:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0 client/mysql.cc: Auto merged client/mysql_upgrade.c: Auto merged client/mysqltest.c: Auto merged extra/yassl/include/yassl_imp.hpp: Auto merged extra/yassl/include/yassl_int.hpp: Auto merged extra/yassl/taocrypt/include/algebra.hpp: Auto merged extra/yassl/taocrypt/include/des.hpp: Auto merged extra/yassl/taocrypt/include/modes.hpp: Auto merged extra/yassl/taocrypt/src/aes.cpp: Auto merged extra/yassl/taocrypt/src/algebra.cpp: Auto merged extra/yassl/taocrypt/test/test.cpp: Auto merged include/my_sys.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_open.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/mysqltest.test: Auto merged ndb/src/common/util/File.cpp: Auto merged ndb/src/common/util/socket_io.cpp: Auto merged ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp: Auto merged ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Auto merged ndb/src/kernel/blocks/dbdih/Dbdih.hpp: Auto merged ndb/src/kernel/blocks/dblqh/Dblqh.hpp: Auto merged ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged ndb/src/kernel/blocks/dbtc/Dbtc.hpp: Auto merged ndb/src/kernel/blocks/dbtup/Dbtup.hpp: Auto merged ndb/src/mgmsrv/Services.cpp: Auto merged ndb/tools/ndb_config.cpp: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.h: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_load.cc: Auto merged sql-common/my_time.c: Auto merged sql/sql_string.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_trigger.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged strings/strtod.c: Auto merged tests/mysql_client_test.c: Auto merged extra/yassl/taocrypt/include/rsa.hpp: manual merge mysql-test/t/mysql.test: manual merge sql/sql_parse.cc: manual merge
This commit is contained in:
commit
2bcbffa0c5
227 changed files with 3273 additions and 3081 deletions
|
|
@ -260,7 +260,7 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
|||
void Item_bool_func2::fix_length_and_dec()
|
||||
{
|
||||
max_length= 1; // Function returns 0 or 1
|
||||
THD *thd= current_thd;
|
||||
THD *thd;
|
||||
|
||||
/*
|
||||
As some compare functions are generated after sql_yacc,
|
||||
|
|
@ -298,12 +298,13 @@ void Item_bool_func2::fix_length_and_dec()
|
|||
return;
|
||||
}
|
||||
|
||||
thd= current_thd;
|
||||
if (!thd->is_context_analysis_only())
|
||||
{
|
||||
Item *real_item= args[0]->real_item();
|
||||
if (real_item->type() == FIELD_ITEM)
|
||||
Item *arg_real_item= args[0]->real_item();
|
||||
if (arg_real_item->type() == FIELD_ITEM)
|
||||
{
|
||||
Field *field=((Item_field*) real_item)->field;
|
||||
Field *field=((Item_field*) arg_real_item)->field;
|
||||
if (field->can_be_compared_as_longlong())
|
||||
{
|
||||
if (convert_constant_item(thd, field,&args[1]))
|
||||
|
|
@ -315,10 +316,10 @@ void Item_bool_func2::fix_length_and_dec()
|
|||
}
|
||||
}
|
||||
}
|
||||
real_item= args[1]->real_item();
|
||||
if (real_item->type() == FIELD_ITEM /* && !real_item->const_item() */)
|
||||
arg_real_item= args[1]->real_item();
|
||||
if (arg_real_item->type() == FIELD_ITEM)
|
||||
{
|
||||
Field *field=((Item_field*) real_item)->field;
|
||||
Field *field=((Item_field*) arg_real_item)->field;
|
||||
if (field->can_be_compared_as_longlong())
|
||||
{
|
||||
if (convert_constant_item(thd, field,&args[0]))
|
||||
|
|
@ -354,9 +355,9 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
|
|||
return 1;
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
if ((*a)->el(i)->cols() != (*b)->el(i)->cols())
|
||||
if ((*a)->element_index(i)->cols() != (*b)->element_index(i)->cols())
|
||||
{
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->el(i)->cols());
|
||||
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
|
||||
return 1;
|
||||
}
|
||||
comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
|
||||
|
|
@ -741,10 +742,10 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
|
|||
uint n= cache->cols();
|
||||
for (uint i= 0; i < n; i++)
|
||||
{
|
||||
if (args[0]->el(i)->used_tables())
|
||||
((Item_cache *)cache->el(i))->set_used_tables(OUTER_REF_TABLE_BIT);
|
||||
if (args[0]->element_index(i)->used_tables())
|
||||
((Item_cache *)cache->element_index(i))->set_used_tables(OUTER_REF_TABLE_BIT);
|
||||
else
|
||||
((Item_cache *)cache->el(i))->set_used_tables(0);
|
||||
((Item_cache *)cache->element_index(i))->set_used_tables(0);
|
||||
}
|
||||
used_tables_cache= args[0]->used_tables();
|
||||
}
|
||||
|
|
@ -815,7 +816,7 @@ longlong Item_in_optimizer::val_int()
|
|||
subselect and see if it has produced any rows.
|
||||
*/
|
||||
((Item_in_subselect*)args[1])->enable_pushed_conds= FALSE;
|
||||
longlong tmp= args[1]->val_bool_result();
|
||||
(void) args[1]->val_bool_result();
|
||||
result_for_null_param= null_value=
|
||||
!((Item_in_subselect*)args[1])->engine->no_rows();
|
||||
((Item_in_subselect*)args[1])->enable_pushed_conds= TRUE;
|
||||
|
|
@ -932,15 +933,15 @@ longlong Item_func_strcmp::val_int()
|
|||
|
||||
void Item_func_interval::fix_length_and_dec()
|
||||
{
|
||||
use_decimal_comparison= (row->el(0)->result_type() == DECIMAL_RESULT) ||
|
||||
(row->el(0)->result_type() == INT_RESULT);
|
||||
use_decimal_comparison= (row->element_index(0)->result_type() == DECIMAL_RESULT) ||
|
||||
(row->element_index(0)->result_type() == INT_RESULT);
|
||||
if (row->cols() > 8)
|
||||
{
|
||||
bool consts=1;
|
||||
|
||||
for (uint i=1 ; consts && i < row->cols() ; i++)
|
||||
{
|
||||
consts&= row->el(i)->const_item();
|
||||
consts&= row->element_index(i)->const_item();
|
||||
}
|
||||
|
||||
if (consts &&
|
||||
|
|
@ -951,7 +952,7 @@ void Item_func_interval::fix_length_and_dec()
|
|||
{
|
||||
for (uint i=1 ; i < row->cols(); i++)
|
||||
{
|
||||
Item *el= row->el(i);
|
||||
Item *el= row->element_index(i);
|
||||
interval_range *range= intervals + (i-1);
|
||||
if ((el->result_type() == DECIMAL_RESULT) ||
|
||||
(el->result_type() == INT_RESULT))
|
||||
|
|
@ -976,7 +977,7 @@ void Item_func_interval::fix_length_and_dec()
|
|||
{
|
||||
for (uint i=1 ; i < row->cols(); i++)
|
||||
{
|
||||
intervals[i-1].dbl= row->el(i)->val_real();
|
||||
intervals[i-1].dbl= row->element_index(i)->val_real();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1016,15 +1017,15 @@ longlong Item_func_interval::val_int()
|
|||
|
||||
if (use_decimal_comparison)
|
||||
{
|
||||
dec= row->el(0)->val_decimal(&dec_buf);
|
||||
if (row->el(0)->null_value)
|
||||
dec= row->element_index(0)->val_decimal(&dec_buf);
|
||||
if (row->element_index(0)->null_value)
|
||||
return -1;
|
||||
my_decimal2double(E_DEC_FATAL_ERROR, dec, &value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value= row->el(0)->val_real();
|
||||
if (row->el(0)->null_value)
|
||||
value= row->element_index(0)->val_real();
|
||||
if (row->element_index(0)->null_value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1060,16 +1061,16 @@ longlong Item_func_interval::val_int()
|
|||
|
||||
for (i=1 ; i < row->cols() ; i++)
|
||||
{
|
||||
Item *el= row->el(i);
|
||||
Item *el= row->element_index(i);
|
||||
if (use_decimal_comparison &&
|
||||
((el->result_type() == DECIMAL_RESULT) ||
|
||||
(el->result_type() == INT_RESULT)))
|
||||
{
|
||||
my_decimal e_dec_buf, *e_dec= row->el(i)->val_decimal(&e_dec_buf);
|
||||
my_decimal e_dec_buf, *e_dec= row->element_index(i)->val_decimal(&e_dec_buf);
|
||||
if (my_decimal_cmp(e_dec, dec) > 0)
|
||||
return i-1;
|
||||
}
|
||||
else if (row->el(i)->val_real() > value)
|
||||
else if (row->element_index(i)->val_real() > value)
|
||||
return i-1;
|
||||
}
|
||||
return i-1;
|
||||
|
|
@ -1792,7 +1793,9 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref)
|
|||
buff should match stack usage from
|
||||
Item_func_case::val_int() -> Item_func_case::find_item()
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
char buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2];
|
||||
#endif
|
||||
bool res= Item_func::fix_fields(thd, ref);
|
||||
/*
|
||||
Call check_stack_overrun after fix_fields to be sure that stack variable
|
||||
|
|
@ -2255,11 +2258,11 @@ void cmp_item_row::store_value(Item *item)
|
|||
{
|
||||
if (!comparators[i])
|
||||
if (!(comparators[i]=
|
||||
cmp_item::get_comparator(item->el(i)->result_type(),
|
||||
item->el(i)->collation.collation)))
|
||||
cmp_item::get_comparator(item->element_index(i)->result_type(),
|
||||
item->element_index(i)->collation.collation)))
|
||||
break; // new failed
|
||||
comparators[i]->store_value(item->el(i));
|
||||
item->null_value|= item->el(i)->null_value;
|
||||
comparators[i]->store_value(item->element_index(i));
|
||||
item->null_value|= item->element_index(i)->null_value;
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
@ -2284,8 +2287,8 @@ void cmp_item_row::store_value_by_template(cmp_item *t, Item *item)
|
|||
if (!(comparators[i]= tmpl->comparators[i]->make_same()))
|
||||
break; // new failed
|
||||
comparators[i]->store_value_by_template(tmpl->comparators[i],
|
||||
item->el(i));
|
||||
item->null_value|= item->el(i)->null_value;
|
||||
item->element_index(i));
|
||||
item->null_value|= item->element_index(i)->null_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2303,9 +2306,9 @@ int cmp_item_row::cmp(Item *arg)
|
|||
arg->bring_value();
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
if (comparators[i]->cmp(arg->el(i)))
|
||||
if (comparators[i]->cmp(arg->element_index(i)))
|
||||
{
|
||||
if (!arg->el(i)->null_value)
|
||||
if (!arg->element_index(i)->null_value)
|
||||
return 1;
|
||||
was_null= 1;
|
||||
}
|
||||
|
|
@ -2316,11 +2319,11 @@ int cmp_item_row::cmp(Item *arg)
|
|||
|
||||
int cmp_item_row::compare(cmp_item *c)
|
||||
{
|
||||
cmp_item_row *cmp= (cmp_item_row *) c;
|
||||
cmp_item_row *l_cmp= (cmp_item_row *) c;
|
||||
for (uint i=0; i < n; i++)
|
||||
{
|
||||
int res;
|
||||
if ((res= comparators[i]->compare(cmp->comparators[i])))
|
||||
if ((res= comparators[i]->compare(l_cmp->comparators[i])))
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -2347,8 +2350,8 @@ int cmp_item_decimal::cmp(Item *arg)
|
|||
|
||||
int cmp_item_decimal::compare(cmp_item *arg)
|
||||
{
|
||||
cmp_item_decimal *cmp= (cmp_item_decimal*) arg;
|
||||
return my_decimal_cmp(&value, &cmp->value);
|
||||
cmp_item_decimal *l_cmp= (cmp_item_decimal*) arg;
|
||||
return my_decimal_cmp(&value, &l_cmp->value);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue