Fixed failing test cases 'row.test' when running with --ps-protocol
Simple optimzations done while reviewing code client/mysqltest.c: Added options --enable-ps-warnings and --disable-ps-warnings (to fix failing test case) mysql-test/t/row.test: Disable warnings that comes from 'parse' parth sql/field.cc: Removed calls to is_null() in field functions. (Not needed as NULL handling is done on the level above fields) Indentation fixes Removed calls to alloca() as buffer needed was quite small. sql/field.h: Indentation changes and comment fixes sql/filesort.cc: Simple optimization during code review sql/item.cc: Indentation fixes Removed some unnecessary tests (added DBUG_ASSERTS() instead) sql/item_buff.cc: Indentation fixes sql/my_decimal.cc: Indentation fixes Simple optimization Fixed compiler warning sql/sql_update.cc: Removed unnessessary assignment
This commit is contained in:
parent
40ffce74eb
commit
67b16d202b
@ -253,6 +253,7 @@ VAR var_reg[10];
|
|||||||
/*Perl/shell-like variable registers */
|
/*Perl/shell-like variable registers */
|
||||||
HASH var_hash;
|
HASH var_hash;
|
||||||
my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0;
|
my_bool disable_query_log=0, disable_result_log=0, disable_warnings=0;
|
||||||
|
my_bool disable_ps_warnings= 0;
|
||||||
my_bool disable_info= 1; /* By default off */
|
my_bool disable_info= 1; /* By default off */
|
||||||
my_bool abort_on_error= 1;
|
my_bool abort_on_error= 1;
|
||||||
|
|
||||||
@ -283,6 +284,7 @@ Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
|
|||||||
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
|
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
|
||||||
Q_WAIT_FOR_SLAVE_TO_STOP,
|
Q_WAIT_FOR_SLAVE_TO_STOP,
|
||||||
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
|
||||||
|
Q_ENABLE_PS_WARNINGS, Q_DISABLE_PS_WARNINGS,
|
||||||
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
Q_ENABLE_INFO, Q_DISABLE_INFO,
|
||||||
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
|
||||||
Q_EXEC, Q_DELIMITER,
|
Q_EXEC, Q_DELIMITER,
|
||||||
@ -360,6 +362,8 @@ const char *command_names[]=
|
|||||||
"wait_for_slave_to_stop",
|
"wait_for_slave_to_stop",
|
||||||
"enable_warnings",
|
"enable_warnings",
|
||||||
"disable_warnings",
|
"disable_warnings",
|
||||||
|
"enable_ps_warnings",
|
||||||
|
"disable_ps_warnings",
|
||||||
"enable_info",
|
"enable_info",
|
||||||
"disable_info",
|
"disable_info",
|
||||||
"enable_metadata",
|
"enable_metadata",
|
||||||
@ -3021,6 +3025,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
|
|||||||
|
|
||||||
/* We may have got warnings already, collect them if any */
|
/* We may have got warnings already, collect them if any */
|
||||||
/* FIXME we only want this if the statement succeeds I think */
|
/* FIXME we only want this if the statement succeeds I think */
|
||||||
|
if (!disable_ps_warnings)
|
||||||
run_query_stmt_handle_warnings(mysql, ds);
|
run_query_stmt_handle_warnings(mysql, ds);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3711,6 +3716,8 @@ int main(int argc, char **argv)
|
|||||||
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
|
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
|
||||||
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
|
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
|
||||||
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
|
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
|
||||||
|
case Q_ENABLE_PS_WARNINGS: disable_ps_warnings=0; break;
|
||||||
|
case Q_DISABLE_PS_WARNINGS: disable_ps_warnings=1; break;
|
||||||
case Q_ENABLE_INFO: disable_info=0; break;
|
case Q_ENABLE_INFO: disable_info=0; break;
|
||||||
case Q_DISABLE_INFO: disable_info=1; break;
|
case Q_DISABLE_INFO: disable_info=1; break;
|
||||||
case Q_ENABLE_METADATA: display_metadata=1; break;
|
case Q_ENABLE_METADATA: display_metadata=1; break;
|
||||||
|
@ -7,7 +7,9 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
|
|||||||
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
|
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
|
||||||
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||||
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
|
||||||
|
--disable_ps_warnings
|
||||||
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
|
||||||
|
--enable_ps_warnings
|
||||||
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
|
||||||
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
|
||||||
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
|
||||||
|
42
sql/field.cc
42
sql/field.cc
@ -572,7 +572,6 @@ my_decimal* Field_num::val_decimal(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(result_type() == INT_RESULT);
|
DBUG_ASSERT(result_type() == INT_RESULT);
|
||||||
longlong nr= val_int();
|
longlong nr= val_int();
|
||||||
if (!is_null())
|
|
||||||
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
|
int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
}
|
}
|
||||||
@ -605,7 +604,7 @@ void Field_num::make_field(Send_field *field)
|
|||||||
d value for storing
|
d value for storing
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
Field_str is the base class for fields like Field_date, and some
|
Field_str is the base class for fields like Field_enum, Field_date and some
|
||||||
similar. Some dates use fraction and also string value should be
|
similar. Some dates use fraction and also string value should be
|
||||||
converted to floating point value according our rules, so we use double
|
converted to floating point value according our rules, so we use double
|
||||||
to store value of decimal in string
|
to store value of decimal in string
|
||||||
@ -629,7 +628,6 @@ my_decimal *Field_str::val_decimal(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(result_type() == INT_RESULT);
|
DBUG_ASSERT(result_type() == INT_RESULT);
|
||||||
longlong nr= val_int();
|
longlong nr= val_int();
|
||||||
if (is_null())
|
|
||||||
int2my_decimal(E_DEC_FATAL_ERROR, nr, 0, decimal_value);
|
int2my_decimal(E_DEC_FATAL_ERROR, nr, 0, decimal_value);
|
||||||
return decimal_value;
|
return decimal_value;
|
||||||
}
|
}
|
||||||
@ -733,6 +731,7 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
Field::quote_data()
|
Field::quote_data()
|
||||||
@ -749,44 +748,35 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
|
|||||||
void Upon prepending/appending quotes on each side of variable
|
void Upon prepending/appending quotes on each side of variable
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Field::quote_data(String *unquoted_string)
|
bool Field::quote_data(String *unquoted_string)
|
||||||
{
|
{
|
||||||
char escaped_string[IO_SIZE];
|
char escaped_string[IO_SIZE];
|
||||||
char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
|
char *unquoted_string_buffer= (char *)(unquoted_string->ptr());
|
||||||
uint need_quotes;
|
uint need_quotes;
|
||||||
|
|
||||||
DBUG_ENTER("Field::quote_data");
|
DBUG_ENTER("Field::quote_data");
|
||||||
|
|
||||||
// this is the same call that mysql_real_escape_string() calls
|
// this is the same call that mysql_real_escape_string() calls
|
||||||
escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
|
escape_string_for_mysql(&my_charset_bin, (char *)escaped_string,
|
||||||
unquoted_string->ptr(), unquoted_string->length());
|
unquoted_string->ptr(), unquoted_string->length());
|
||||||
|
|
||||||
|
|
||||||
if (is_null())
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
need_quotes= needs_quotes();
|
need_quotes= needs_quotes();
|
||||||
|
|
||||||
if (need_quotes == 0)
|
if (need_quotes == 0)
|
||||||
{
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// reset string, then re-append with quotes and escaped values
|
// reset string, then re-append with quotes and escaped values
|
||||||
unquoted_string->length(0);
|
unquoted_string->length(0);
|
||||||
if (unquoted_string->append("'"))
|
if (unquoted_string->append('\''))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (unquoted_string->append((char *)escaped_string))
|
if (unquoted_string->append((char *)escaped_string))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (unquoted_string->append("'"))
|
if (unquoted_string->append('\''))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
|
||||||
//DBUG_PRINT("Field::quote_data",
|
|
||||||
// ("FINAL quote_flag %d unquoted_string %s escaped_string %s",
|
|
||||||
//needs_quotes, unquoted_string->c_ptr_quick(), escaped_string));
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Quote a field type if needed
|
Quote a field type if needed
|
||||||
|
|
||||||
@ -802,6 +792,7 @@ bool Field::quote_data(String *unquoted_string)
|
|||||||
0 if value is of type NOT needing quotes
|
0 if value is of type NOT needing quotes
|
||||||
1 if value is of type needing quotes
|
1 if value is of type needing quotes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Field::needs_quotes(void)
|
bool Field::needs_quotes(void)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Field::type_quote");
|
DBUG_ENTER("Field::type_quote");
|
||||||
@ -840,9 +831,9 @@ bool Field::needs_quotes(void)
|
|||||||
default: DBUG_RETURN(0);
|
default: DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Field_null, a field that always return NULL
|
Field_null, a field that always return NULL
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -4646,8 +4637,6 @@ String *Field_newdate::val_str(String *val_buffer,
|
|||||||
|
|
||||||
bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
bool Field_newdate::get_date(TIME *ltime,uint fuzzydate)
|
||||||
{
|
{
|
||||||
if (is_null())
|
|
||||||
return 1;
|
|
||||||
uint32 tmp=(uint32) uint3korr(ptr);
|
uint32 tmp=(uint32) uint3korr(ptr);
|
||||||
ltime->day= tmp & 31;
|
ltime->day= tmp & 31;
|
||||||
ltime->month= (tmp >> 5) & 15;
|
ltime->month= (tmp >> 5) & 15;
|
||||||
@ -5058,17 +5047,16 @@ int Field_string::store(longlong nr)
|
|||||||
return Field_string::store(buff,(uint)l,cs);
|
return Field_string::store(buff,(uint)l,cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Field_longstr::store_decimal(const my_decimal *d)
|
int Field_longstr::store_decimal(const my_decimal *d)
|
||||||
{
|
{
|
||||||
uint buf_size= my_decimal_string_length(d);
|
char buff[DECIMAL_MAX_STR_LENGTH+1];
|
||||||
char *buff= (char *)my_alloca(buf_size);
|
String str(buff, sizeof(buff), &my_charset_bin);
|
||||||
String str(buff, buf_size, &my_charset_bin);
|
|
||||||
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
|
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
|
||||||
int result= store(str.ptr(), str.length(), str.charset());
|
return store(str.ptr(), str.length(), str.charset());
|
||||||
my_afree(buff);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Field_string::val_real(void)
|
double Field_string::val_real(void)
|
||||||
{
|
{
|
||||||
int not_used;
|
int not_used;
|
||||||
|
@ -367,7 +367,9 @@ public:
|
|||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* base class for Item_string, Item_valstring, Item_blob */
|
|
||||||
|
/* base class for Field_string, Field_varstring and Field_blob */
|
||||||
|
|
||||||
class Field_longstr :public Field_str
|
class Field_longstr :public Field_str
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -1181,7 +1183,9 @@ public:
|
|||||||
bool has_charset(void) const
|
bool has_charset(void) const
|
||||||
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
|
||||||
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
|
field_cast_enum field_cast_type() { return FIELD_CAST_BLOB; }
|
||||||
uint32 max_length();};
|
uint32 max_length();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
class Field_geom :public Field_blob {
|
class Field_geom :public Field_blob {
|
||||||
|
@ -619,20 +619,21 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
else
|
else
|
||||||
{ // Item
|
{ // Item
|
||||||
Item *item=sort_field->item;
|
Item *item=sort_field->item;
|
||||||
|
maybe_null= item->maybe_null;
|
||||||
switch (sort_field->result_type) {
|
switch (sort_field->result_type) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs=item->collation.collation;
|
CHARSET_INFO *cs=item->collation.collation;
|
||||||
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
|
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
|
||||||
|
|
||||||
if ((maybe_null=item->maybe_null))
|
if (maybe_null)
|
||||||
*to++=1;
|
*to++=1;
|
||||||
/* All item->str() to use some extra byte for end null.. */
|
/* All item->str() to use some extra byte for end null.. */
|
||||||
String tmp((char*) to,sort_field->length+4,cs);
|
String tmp((char*) to,sort_field->length+4,cs);
|
||||||
String *res=item->val_str(&tmp);
|
String *res=item->val_str(&tmp);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
if (item->maybe_null)
|
if (maybe_null)
|
||||||
bzero((char*) to-1,sort_field->length+1);
|
bzero((char*) to-1,sort_field->length+1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -672,11 +673,12 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
{
|
{
|
||||||
longlong value=item->val_int();
|
longlong value=item->val_int();
|
||||||
if ((maybe_null=item->maybe_null))
|
if (maybe_null)
|
||||||
|
{
|
||||||
*to++=1; /* purecov: inspected */
|
*to++=1; /* purecov: inspected */
|
||||||
if (item->null_value)
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
if (item->maybe_null)
|
if (maybe_null)
|
||||||
bzero((char*) to-1,sort_field->length+1);
|
bzero((char*) to-1,sort_field->length+1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -686,6 +688,7 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#if SIZEOF_LONG_LONG > 4
|
#if SIZEOF_LONG_LONG > 4
|
||||||
to[7]= (uchar) value;
|
to[7]= (uchar) value;
|
||||||
to[6]= (uchar) (value >> 8);
|
to[6]= (uchar) (value >> 8);
|
||||||
@ -706,14 +709,16 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
{
|
{
|
||||||
my_decimal dec_buf, *dec_val= item->val_decimal(&dec_buf);
|
my_decimal dec_buf, *dec_val= item->val_decimal(&dec_buf);
|
||||||
if ((maybe_null=item->null_value))
|
if (maybe_null)
|
||||||
|
{
|
||||||
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
bzero((char*)to, sort_field->length+1);
|
bzero((char*)to, sort_field->length+1);
|
||||||
to++;
|
to++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((maybe_null=item->maybe_null))
|
|
||||||
*to++=1;
|
*to++=1;
|
||||||
|
}
|
||||||
my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (byte*)to,
|
my_decimal2binary(E_DEC_FATAL_ERROR, dec_val, (byte*)to,
|
||||||
item->max_length - (item->decimals ? 1:0),
|
item->max_length - (item->decimals ? 1:0),
|
||||||
item->decimals);
|
item->decimals);
|
||||||
@ -722,14 +727,16 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
{
|
{
|
||||||
double value= item->val_real();
|
double value= item->val_real();
|
||||||
if ((maybe_null=item->null_value))
|
if (maybe_null)
|
||||||
|
{
|
||||||
|
if (item->null_value)
|
||||||
{
|
{
|
||||||
bzero((char*) to,sort_field->length+1);
|
bzero((char*) to,sort_field->length+1);
|
||||||
to++;
|
to++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((maybe_null=item->maybe_null))
|
|
||||||
*to++=1;
|
*to++=1;
|
||||||
|
}
|
||||||
change_double_for_sort(value,(byte*) to);
|
change_double_for_sort(value,(byte*) to);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
41
sql/item.cc
41
sql/item.cc
@ -48,10 +48,10 @@ void item_init(void)
|
|||||||
/*
|
/*
|
||||||
TODO: make this functions class dependent
|
TODO: make this functions class dependent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item::val_bool()
|
bool Item::val_bool()
|
||||||
{
|
{
|
||||||
switch(result_type())
|
switch(result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return val_int();
|
return val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@ -68,6 +68,7 @@ bool Item::val_bool()
|
|||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
|
return 0; // Wrong (but safe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,8 +992,7 @@ bool Item_field::val_bool_result()
|
|||||||
{
|
{
|
||||||
if ((null_value= result_field->is_null()))
|
if ((null_value= result_field->is_null()))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
switch (result_field->result_type())
|
switch (result_field->result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return result_field->val_int();
|
return result_field->val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@ -1060,8 +1060,9 @@ Item *Item_field::get_tmp_table_item(THD *thd)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Create an item from a string we KNOW points to a valid longlong/ulonglong
|
Create an item from a string we KNOW points to a valid longlong
|
||||||
end \0 terminated number string
|
end \0 terminated number string.
|
||||||
|
This is always 'signed'. Unsigned values are created with Item_uint()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Item_int::Item_int(const char *str_arg, uint length)
|
Item_int::Item_int(const char *str_arg, uint length)
|
||||||
@ -1071,7 +1072,6 @@ Item_int::Item_int(const char *str_arg, uint length)
|
|||||||
value= my_strtoll10(str_arg, &end_ptr, &error);
|
value= my_strtoll10(str_arg, &end_ptr, &error);
|
||||||
max_length= (uint) (end_ptr - str_arg);
|
max_length= (uint) (end_ptr - str_arg);
|
||||||
name= (char*) str_arg;
|
name= (char*) str_arg;
|
||||||
unsigned_flag= value > 0;
|
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2436,8 +2436,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||||||
rf is Item_ref => never substitute other items (in this case)
|
rf is Item_ref => never substitute other items (in this case)
|
||||||
during fix_fields() => we can use rf after fix_fields()
|
during fix_fields() => we can use rf after fix_fields()
|
||||||
*/
|
*/
|
||||||
if (!rf->fixed &&
|
DBUG_ASSERT(!rf->fixed); // Assured by Item_ref()
|
||||||
rf->fix_fields(thd, tables, reference) || rf->check_cols(1))
|
if (rf->fix_fields(thd, tables, reference) || rf->check_cols(1))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
mark_as_dependent(thd, last, current_sel, rf);
|
mark_as_dependent(thd, last, current_sel, rf);
|
||||||
@ -2458,8 +2458,8 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||||||
rf is Item_ref => never substitute other items (in this case)
|
rf is Item_ref => never substitute other items (in this case)
|
||||||
during fix_fields() => we can use rf after fix_fields()
|
during fix_fields() => we can use rf after fix_fields()
|
||||||
*/
|
*/
|
||||||
return (!rf->fixed &&
|
DBUG_ASSERT(!rf->fixed); // Assured by Item_ref()
|
||||||
rf->fix_fields(thd, tables, reference) || rf->check_cols(1));
|
return (rf->fix_fields(thd, tables, reference) || rf->check_cols(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2706,8 +2706,7 @@ void Item_empty_string::make_field(Send_field *tmp_field)
|
|||||||
|
|
||||||
enum_field_types Item::field_type() const
|
enum_field_types Item::field_type() const
|
||||||
{
|
{
|
||||||
switch (result_type())
|
switch (result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT: return MYSQL_TYPE_VARCHAR;
|
case STRING_RESULT: return MYSQL_TYPE_VARCHAR;
|
||||||
case INT_RESULT: return FIELD_TYPE_LONGLONG;
|
case INT_RESULT: return FIELD_TYPE_LONGLONG;
|
||||||
case DECIMAL_RESULT: return FIELD_TYPE_NEWDECIMAL;
|
case DECIMAL_RESULT: return FIELD_TYPE_NEWDECIMAL;
|
||||||
@ -2715,8 +2714,8 @@ enum_field_types Item::field_type() const
|
|||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
DBUG_ASSERT(0);
|
DBUG_ASSERT(0);
|
||||||
return FIELD_TYPE_VAR_STRING;
|
return MYSQL_TYPE_VARCHAR;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3662,8 +3661,7 @@ bool Item_ref::val_bool_result()
|
|||||||
{
|
{
|
||||||
if ((null_value= result_field->is_null()))
|
if ((null_value= result_field->is_null()))
|
||||||
return 0;
|
return 0;
|
||||||
switch (result_field->result_type())
|
switch (result_field->result_type()) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return result_field->val_int();
|
return result_field->val_int();
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
@ -4049,8 +4047,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||||||
item->result_type());
|
item->result_type());
|
||||||
char *name=item->name; // Alloced by sql_alloc
|
char *name=item->name; // Alloced by sql_alloc
|
||||||
|
|
||||||
switch (res_type)
|
switch (res_type) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
@ -4146,8 +4143,7 @@ bool field_is_equal_to_item(Field *field,Item *item)
|
|||||||
|
|
||||||
Item_cache* Item_cache::get_cache(Item_result type)
|
Item_cache* Item_cache::get_cache(Item_result type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return new Item_cache_int();
|
return new Item_cache_int();
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
@ -4617,8 +4613,7 @@ uint32 Item_type_holder::real_length(Item *item)
|
|||||||
if (item->type() == Item::FIELD_ITEM)
|
if (item->type() == Item::FIELD_ITEM)
|
||||||
return ((Item_field *)item)->max_disp_length();
|
return ((Item_field *)item)->max_disp_length();
|
||||||
|
|
||||||
switch (item->result_type())
|
switch (item->result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
case DECIMAL_RESULT:
|
case DECIMAL_RESULT:
|
||||||
return item->max_length;
|
return item->max_length;
|
||||||
|
@ -28,8 +28,7 @@ Item_buff *new_Item_buff(Item *item)
|
|||||||
if (item->type() == Item::FIELD_ITEM &&
|
if (item->type() == Item::FIELD_ITEM &&
|
||||||
!(((Item_field *) item)->field->flags & BLOB_FLAG))
|
!(((Item_field *) item)->field->flags & BLOB_FLAG))
|
||||||
return new Item_field_buff((Item_field *) item);
|
return new Item_field_buff((Item_field *) item);
|
||||||
switch (item->result_type())
|
switch (item->result_type()) {
|
||||||
{
|
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
return new Item_str_buff((Item_field *) item);
|
return new Item_str_buff((Item_field *) item);
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
|
@ -23,16 +23,18 @@
|
|||||||
decimal_operation_results()
|
decimal_operation_results()
|
||||||
result decimal library return code (E_DEC_* see include/decimal.h)
|
result decimal library return code (E_DEC_* see include/decimal.h)
|
||||||
|
|
||||||
return
|
TODO
|
||||||
|
Fix error messages
|
||||||
|
|
||||||
|
RETURN
|
||||||
result
|
result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int decimal_operation_results(int result)
|
int decimal_operation_results(int result)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result) {
|
||||||
{
|
|
||||||
case E_DEC_OK:
|
case E_DEC_OK:
|
||||||
break;
|
break;
|
||||||
//TODO: fix error messages
|
|
||||||
case E_DEC_TRUNCATED:
|
case E_DEC_TRUNCATED:
|
||||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
|
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
|
||||||
@ -85,13 +87,11 @@ int my_decimal2string(uint mask, const my_decimal *d,
|
|||||||
int result;
|
int result;
|
||||||
if (str->alloc(length))
|
if (str->alloc(length))
|
||||||
return check_result(mask, E_DEC_OOM);
|
return check_result(mask, E_DEC_OOM);
|
||||||
char *sptr= (char *)str->ptr();
|
result= decimal2string((decimal*) d, (char*) str->ptr(),
|
||||||
int res= decimal2string((decimal *)d, sptr,
|
|
||||||
&length, fixed_prec, fixed_dec,
|
&length, fixed_prec, fixed_dec,
|
||||||
filler);
|
filler);
|
||||||
result= check_result(mask, res);
|
|
||||||
str->length(length);
|
str->length(length);
|
||||||
return result;
|
return check_result(mask, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ int str2my_decimal(uint mask, const char *from, uint length,
|
|||||||
}
|
}
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
err= string2decimal((char *)from, (decimal *)decimal_value, &end);
|
err= string2decimal((char *)from, (decimal *)decimal_value, &end);
|
||||||
if ((end-from) != length && !err)
|
if ((uint) (end-from) != length && !err)
|
||||||
err= E_DEC_TRUNCATED;
|
err= E_DEC_TRUNCATED;
|
||||||
check_result(mask, err);
|
check_result(mask, err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -264,10 +264,8 @@ int mysql_update(THD *thd,
|
|||||||
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
|
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
|
||||||
used_key_is_modified=check_if_key_used(table, used_index, fields);
|
used_key_is_modified=check_if_key_used(table, used_index, fields);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
used_key_is_modified=0;
|
used_key_is_modified=0;
|
||||||
used_index= MAX_KEY;
|
|
||||||
}
|
|
||||||
if (used_key_is_modified || order)
|
if (used_key_is_modified || order)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user