diff options
author | unknown <nick@mysql.com> | 2002-10-22 15:17:17 -0600 |
---|---|---|
committer | unknown <nick@mysql.com> | 2002-10-22 15:17:17 -0600 |
commit | d326428c41429ea501d4b9098ab3d6084733bb32 (patch) | |
tree | 599b4e1aaa80541b807a59a9d9a5538337e4d2f3 /sql/item_func.cc | |
parent | d2e52820f6b8f4d345af2a5e5c6a5fa792171757 (diff) | |
download | mariadb-git-d326428c41429ea501d4b9098ab3d6084733bb32.tar.gz |
Added Rand_log_event
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 609e0042704..08193df5de6 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -698,17 +698,31 @@ double Item_func_round::val() double Item_func_rand::val() { + THD* thd = current_thd; if (arg_count) { // Only use argument once in query uint32 tmp= (uint32) (args[0]->val_int()); - randominit(¤t_thd->rand,(uint32) (tmp*0x10001L+55555555L), + randominit(&thd->rand,(uint32) (tmp*0x10001L+55555555L), (uint32) (tmp*0x10000001L)); #ifdef DELETE_ITEMS delete args[0]; #endif arg_count=0; } - return rnd(¤t_thd->rand); + else if (0)//!thd->rand_used) + { + // 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. + + // save the seed only the first time RAND() is used in the query + + // once events are forwarded rather than recreated, + // the following can be skipped if inside the slave thread + thd->rand_used=1; + thd->rand_saved_seed1=thd->rand.seed1; + thd->rand_saved_seed2=thd->rand.seed2; + } + return rnd(&thd->rand); } longlong Item_func_sign::val_int() |