summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorkaa@polly.local <>2006-09-13 14:41:28 +0400
committerkaa@polly.local <>2006-09-13 14:41:28 +0400
commit397f0df9ad2df62698d4c1824c965c4b884b990c (patch)
tree1a5961fcf20771718331caeaeb16054878a411e9 /sql
parent5df7611caa310a88666f7fd2a7f14bd23ca8e24a (diff)
downloadmariadb-git-397f0df9ad2df62698d4c1824c965c4b884b990c.tar.gz
Cset exclude: kaa@polly.local|ChangeSet|20060912122540|09861
Cset exclude: kaa@polly.local|ChangeSet|20060908100829|09983
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc21
-rw-r--r--sql/item_cmpfunc.h14
-rw-r--r--sql/item_func.cc42
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/sql_class.h1
6 files changed, 24 insertions, 58 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index cf8d0c39d58..f14efc7187b 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -619,7 +619,11 @@ int Arg_comparator::compare_int_signed_unsigned()
if (!(*b)->null_value)
{
owner->null_value= 0;
- return ::compare_int_signed_unsigned(sval1, uval2);
+ if (sval1 < 0 || (ulonglong)sval1 < uval2)
+ return -1;
+ if ((ulonglong)sval1 == uval2)
+ return 0;
+ return 1;
}
}
owner->null_value= 1;
@@ -640,7 +644,13 @@ int Arg_comparator::compare_int_unsigned_signed()
if (!(*b)->null_value)
{
owner->null_value= 0;
- return ::compare_int_unsigned_signed(uval1, sval2);
+ if (sval2 < 0)
+ return 1;
+ if (uval1 < (ulonglong)sval2)
+ return -1;
+ if (uval1 == (ulonglong)sval2)
+ return 0;
+ return 1;
}
}
owner->null_value= 1;
@@ -1152,13 +1162,11 @@ Item_func_ifnull::val_int()
if (!args[0]->null_value)
{
null_value=0;
- unsigned_flag= args[0]->unsigned_flag;
return value;
}
value=args[1]->val_int();
if ((null_value=args[1]->null_value))
return 0;
- unsigned_flag= args[1]->unsigned_flag;
return value;
}
@@ -1278,7 +1286,6 @@ Item_func_if::val_int()
Item *arg= args[0]->val_int() ? args[1] : args[2];
longlong value=arg->val_int();
null_value=arg->null_value;
- unsigned_flag= arg->unsigned_flag;
return value;
}
@@ -1485,7 +1492,6 @@ longlong Item_func_case::val_int()
}
res=item->val_int();
null_value=item->null_value;
- unsigned_flag= item->unsigned_flag;
return res;
}
@@ -1617,10 +1623,7 @@ longlong Item_func_coalesce::val_int()
{
longlong res=args[i]->val_int();
if (!args[i]->null_value)
- {
- unsigned_flag= args[i]->unsigned_flag;
return res;
- }
}
null_value=1;
return 0;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 513260205c2..73abe208d9e 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1077,17 +1077,3 @@ inline Item *and_conds(Item *a, Item *b)
}
Item *and_expressions(Item *a, Item *b, Item **org_item);
-
-inline int compare_int_signed_unsigned(longlong sval, ulonglong uval)
-{
- if (sval < 0 || (ulonglong)sval < uval)
- return -1;
- if ((ulonglong)sval == uval)
- return 0;
- return 1;
-}
-
-inline int compare_int_unsigned_signed(ulonglong uval, longlong sval)
-{
- return -compare_int_signed_unsigned(sval, uval);
-}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index d43dadfa4a4..91ccef6511f 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1235,34 +1235,19 @@ longlong Item_func_min_max::val_int()
{
DBUG_ASSERT(fixed == 1);
longlong value=0;
- my_bool arg_unsigned_flag;
- my_bool cmp;
null_value=1;
for (uint i=0; i < arg_count ; i++)
{
- longlong tmp= args[i]->val_int();
- arg_unsigned_flag= args[i]->unsigned_flag;
if (null_value)
{
- value= tmp;
+ value=args[i]->val_int();
null_value=args[i]->null_value;
- unsigned_flag= arg_unsigned_flag;
}
else
{
- if (args[i]->null_value)
- continue;
- if (unsigned_flag == arg_unsigned_flag)
- cmp= tmp < value;
- else if (unsigned_flag)
- cmp= compare_int_signed_unsigned(tmp, value) < 0;
- else
- cmp= compare_int_unsigned_signed(tmp, value) < 0;
- if ((cmp ? cmp_sign : -cmp_sign) > 0)
- {
- value= tmp;
- unsigned_flag= arg_unsigned_flag;
- }
+ longlong tmp=args[i]->val_int();
+ if (!args[i]->null_value && (tmp < value ? cmp_sign : -cmp_sign) > 0)
+ value=tmp;
}
}
return value;
@@ -2328,7 +2313,6 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
entry->length=0;
entry->update_query_id=0;
entry->collation.set(NULL, DERIVATION_IMPLICIT);
- entry->unsigned_flag= 0;
/*
If we are here, we were called from a SET or a query which sets a
variable. Imagine it is this:
@@ -2406,7 +2390,7 @@ Item_func_set_user_var::fix_length_and_dec()
bool Item_func_set_user_var::update_hash(void *ptr, uint length,
Item_result type,
CHARSET_INFO *cs,
- Derivation dv, bool unsigned_arg)
+ Derivation dv)
{
if ((null_value=args[0]->null_value))
{
@@ -2453,7 +2437,6 @@ bool Item_func_set_user_var::update_hash(void *ptr, uint length,
entry->length= length;
entry->type=type;
entry->collation.set(cs, dv);
- entry->unsigned_flag= unsigned_arg;
}
return 0;
@@ -2524,10 +2507,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
str->set(*(double*) value, decimals, &my_charset_bin);
break;
case INT_RESULT:
- if (!unsigned_flag)
- str->set(*(longlong*) value, &my_charset_bin);
- else
- str->set(*(ulonglong*) value, &my_charset_bin);
+ str->set(*(longlong*) value, &my_charset_bin);
break;
case STRING_RESULT:
if (str->copy(value, length, collation.collation))
@@ -2568,7 +2548,6 @@ Item_func_set_user_var::check()
case INT_RESULT:
{
save_result.vint= args[0]->val_int();
- unsigned_flag= args[0]->unsigned_flag;
break;
}
case STRING_RESULT:
@@ -2613,26 +2592,25 @@ Item_func_set_user_var::update()
case REAL_RESULT:
{
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
- REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
+ REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
break;
}
case INT_RESULT:
{
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
- INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
- unsigned_flag);
+ INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT);
break;
}
case STRING_RESULT:
{
if (!save_result.vstr) // Null value
res= update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin,
- DERIVATION_IMPLICIT, 0);
+ DERIVATION_IMPLICIT);
else
res= update_hash((void*) save_result.vstr->ptr(),
save_result.vstr->length(), STRING_RESULT,
save_result.vstr->charset(),
- DERIVATION_IMPLICIT, 0);
+ DERIVATION_IMPLICIT);
break;
}
case ROW_RESULT:
diff --git a/sql/item_func.h b/sql/item_func.h
index 3a29b9d6f15..f4a1258a02c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -962,7 +962,7 @@ public:
longlong val_int();
String *val_str(String *str);
bool update_hash(void *ptr, uint length, enum Item_result type,
- CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
+ CHARSET_INFO *cs, Derivation dv);
bool check();
bool update();
enum Item_result result_type () const { return cached_result_type; }
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ef375a30441..19c32b2d28e 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -2607,7 +2607,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
a single record and with a single column. Thus, like
a column value, it could always have IMPLICIT derivation.
*/
- e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
+ e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT);
free_root(thd->mem_root,0);
rli->inc_event_relay_log_pos(get_event_len());
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 2db0077c0b4..f1cf9c7b3e2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1460,7 +1460,6 @@ class user_var_entry
char *value;
ulong length, update_query_id, used_query_id;
Item_result type;
- bool unsigned_flag;
double val(my_bool *null_value);
longlong val_int(my_bool *null_value);