~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/item_func.cc

MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2749
2749
** Rewritten by monty.
2750
2750
****************************************************************************/
2751
2751
 
2752
 
#ifdef HAVE_DLOPEN
2753
 
 
2754
2752
void udf_handler::cleanup()
2755
2753
{
2756
2754
  if (!not_original)
2762
2760
        Udf_func_deinit deinit= u_d->func_deinit;
2763
2761
        (*deinit)(&initid);
2764
2762
      }
2765
 
      free_udf(u_d);
 
2763
 
2766
2764
      initialized= false;
2767
2765
    }
2768
2766
    if (buffers)                                // Because of bug in ecc
2781
2779
  if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
2782
2780
    return(true);                               // Fatal error flag is set!
2783
2781
 
2784
 
  udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1);
 
2782
  udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length);
2785
2783
 
2786
2784
  if (!tmp_udf)
2787
2785
  {
2802
2800
          sql_alloc(f_args.arg_count*sizeof(Item_result))))
2803
2801
 
2804
2802
    {
2805
 
      free_udf(u_d);
2806
2803
      return(true);
2807
2804
    }
2808
2805
    uint i;
2849
2846
        !(f_args.attribute_lengths= (ulong*) sql_alloc(arg_count *
2850
2847
                                                       sizeof(long))))
2851
2848
    {
2852
 
      free_udf(u_d);
2853
2849
      return(true);
2854
2850
    }
2855
2851
  }
2918
2914
    {
2919
2915
      my_error(ER_CANT_INITIALIZE_UDF, MYF(0),
2920
2916
               u_d->name.str, init_msg_buff);
2921
 
      free_udf(u_d);
2922
2917
      return(true);
2923
2918
    }
2924
2919
    func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
3195
3190
  assert(not_original || !(initialized || buffers));
3196
3191
}
3197
3192
 
3198
 
#else
3199
 
bool udf_handler::get_arguments() { return 0; }
3200
 
#endif /* HAVE_DLOPEN */
3201
 
 
3202
3193
/*
3203
3194
** User level locks
3204
3195
*/
4595
4586
 
4596
4587
  return thd->found_rows();
4597
4588
}
4598
 
 
4599
 
 
4600
 
 
4601
 
/*
4602
 
  uuid_short handling.
4603
 
 
4604
 
  The short uuid is defined as a longlong that contains the following bytes:
4605
 
 
4606
 
  Bytes  Comment
4607
 
  1      Server_id & 255
4608
 
  4      Startup time of server in seconds
4609
 
  3      Incrementor
4610
 
 
4611
 
  This means that an uuid is guaranteed to be unique
4612
 
  even in a replication environment if the following holds:
4613
 
 
4614
 
  - The last byte of the server id is unique
4615
 
  - If you between two shutdown of the server don't get more than
4616
 
    an average of 2^24 = 16M calls to uuid_short() per second.
4617
 
*/
4618
 
 
4619
 
ulonglong uuid_value;
4620
 
 
4621
 
void uuid_short_init()
4622
 
{
4623
 
  uuid_value= ((((ulonglong) server_id) << 56) + 
4624
 
               (((ulonglong) server_start_time) << 24));
4625
 
}
4626
 
 
4627
 
 
4628
 
longlong Item_func_uuid_short::val_int()
4629
 
{
4630
 
  ulonglong val;
4631
 
  pthread_mutex_lock(&LOCK_uuid_generator);
4632
 
  val= uuid_value++;
4633
 
  pthread_mutex_unlock(&LOCK_uuid_generator);
4634
 
  return (longlong) val;
4635
 
}