~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/rand.cc

  • Committer: Brian Aker
  • Date: 2008-10-20 04:28:21 UTC
  • mto: (492.3.21 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: brian@tangent.org-20081020042821-rqqdrccuu8195k3y
Second pass of thd cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
             (uint32_t) (tmp*0x10000001L));
33
33
}
34
34
 
35
 
bool Item_func_rand::fix_fields(Session *thd,Item **ref)
 
35
bool Item_func_rand::fix_fields(Session *session,Item **ref)
36
36
{
37
 
  if (Item_real_func::fix_fields(thd, ref))
 
37
  if (Item_real_func::fix_fields(session, ref))
38
38
    return true;
39
39
  used_tables_cache|= RAND_TABLE_BIT;
40
40
  if (arg_count)
44
44
      as it will be replicated in the query as such.
45
45
    */
46
46
    if (!rand && !(rand= (struct rand_struct*)
47
 
                   thd->alloc(sizeof(*rand))))
 
47
                   session->alloc(sizeof(*rand))))
48
48
      return true;
49
49
 
50
50
    if (args[0]->const_item())
57
57
      Once events are forwarded rather than recreated,
58
58
      the following can be skipped if inside the slave thread
59
59
    */
60
 
    if (!thd->rand_used)
 
60
    if (!session->rand_used)
61
61
    {
62
 
      thd->rand_used= 1;
63
 
      thd->rand_saved_seed1= thd->rand.seed1;
64
 
      thd->rand_saved_seed2= thd->rand.seed2;
 
62
      session->rand_used= 1;
 
63
      session->rand_saved_seed1= session->rand.seed1;
 
64
      session->rand_saved_seed2= session->rand.seed2;
65
65
    }
66
 
    rand= &thd->rand;
 
66
    rand= &session->rand;
67
67
  }
68
68
  return false;
69
69
}