summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-12-03 13:08:25 +0200
committerunknown <monty@hundin.mysql.fi>2002-12-03 13:08:25 +0200
commit80b143c111fc3df20e3fe2dcfe4880c30b001498 (patch)
tree4cad7c11d248679cf59fce6e92c37d2d7dc6e486 /sql/item_func.cc
parent4f221e351df6c05fdeb95d0b328cf155204195cd (diff)
downloadmariadb-git-80b143c111fc3df20e3fe2dcfe4880c30b001498.tar.gz
Change of internal key_field=NULL handling to avoid error messages.
Optimized SELECT DISTINCT ... ORDER BY ... LIMIT Fixed reference to uninitalized variable mysql-test/r/distinct.result: Updated results for new tests mysql-test/r/func_math.result: Fixed test of RND() mysql-test/r/innodb.result: Updated results for new tests mysql-test/r/null.result: Updated results for new tests mysql-test/t/distinct.test: New distinct test mysql-test/t/func_math.test: Fixed test of RND() mysql-test/t/innodb.test: Test for bugs mysql-test/t/null.test: TEst for bugs sql/field.h: Change of NULL handling to avoid error messages sql/field_conv.cc: Change of NULL handling to avoid error messages sql/item.cc: Change of NULL handling to avoid error messages sql/item.h: Change of NULL handling to avoid error messages sql/item_cmpfunc.cc: Change of NULL handling to avoid error messages sql/item_func.cc: Change of NULL handling to avoid error messages sql/item_func.h: Cleaned up RND() handling sql/item_timefunc.cc: Change of NULL handling to avoid error messages sql/item_timefunc.h: Change of NULL handling to avoid error messages sql/opt_range.cc: Fixed bug in <=> NULL sql/password.c: Indentation cleanup sql/sql_base.cc: Change of NULL handling to avoid error messages sql/sql_class.cc: Fixed reference to uninitalized variable sql/sql_handler.cc: Change of NULL handling to avoid error messages sql/sql_select.cc: Change of NULL handling to avoid error messages Optimized SELECT DISTINCT ... ORDER BY ... LIMIT sql/sql_select.h: Change of NULL handling to avoid error messages sql/unireg.cc: Change of NULL handling to avoid error messages
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 5721a2f5e8c..c3b1190a4b6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -696,21 +696,20 @@ double Item_func_round::val()
}
-double Item_func_rand::val()
+void Item_func_rand::fix_length_and_dec()
{
- THD* thd = current_thd;
+ decimals=NOT_FIXED_DEC;
+ max_length=float_length(decimals);
if (arg_count)
{ // Only use argument once in query
uint32 tmp= (uint32) (args[0]->val_int());
- randominit(&thd->rand,(uint32) (tmp*0x10001L+55555555L),
- (uint32) (tmp*0x10000001L));
-#ifdef DELETE_ITEMS
- delete args[0];
-#endif
- arg_count=0;
+ if ((rand= (struct rand_struct*) sql_alloc(sizeof(*rand))))
+ randominit(rand,(uint32) (tmp*0x10001L+55555555L),
+ (uint32) (tmp*0x10000001L));
}
- else if (!thd->rand_used)
+ else
{
+ THD *thd= current_thd;
/*
No need to send a Rand log event if seed was given eg: RAND(seed),
as it will be replicated in the query as such.
@@ -722,8 +721,14 @@ double Item_func_rand::val()
thd->rand_used=1;
thd->rand_saved_seed1=thd->rand.seed1;
thd->rand_saved_seed2=thd->rand.seed2;
+ rand= &thd->rand;
}
- return rnd(&thd->rand);
+}
+
+
+double Item_func_rand::val()
+{
+ return rnd(rand);
}
longlong Item_func_sign::val_int()