~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_func.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 05:57:49 UTC
  • Revision ID: brian@tangent.org-20081006055749-svg700gciuqi0zu1
Remove all of uchar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
  assert(fixed == 0);
136
136
  Item **arg,**arg_end;
137
137
  void *save_thd_marker= thd->thd_marker;
138
 
  uchar buff[STACK_BUFF_ALLOC];                 // Max argument in function
 
138
  unsigned char buff[STACK_BUFF_ALLOC];                 // Max argument in function
139
139
  thd->thd_marker= 0;
140
140
  used_tables_cache= not_null_tables_cache= 0;
141
141
  const_item_cache=1;
211
211
 
212
212
 
213
213
bool Item_func::walk(Item_processor processor, bool walk_subquery,
214
 
                     uchar *argument)
 
214
                     unsigned char *argument)
215
215
{
216
216
  if (arg_count)
217
217
  {
270
270
    Item returned as the result of transformation of the root node
271
271
*/
272
272
 
273
 
Item *Item_func::transform(Item_transformer transformer, uchar *argument)
 
273
Item *Item_func::transform(Item_transformer transformer, unsigned char *argument)
274
274
{
275
275
  if (arg_count)
276
276
  {
319
319
    Item returned as the result of transformation of the root node
320
320
*/
321
321
 
322
 
Item *Item_func::compile(Item_analyzer analyzer, uchar **arg_p,
323
 
                         Item_transformer transformer, uchar *arg_t)
 
322
Item *Item_func::compile(Item_analyzer analyzer, unsigned char **arg_p,
 
323
                         Item_transformer transformer, unsigned char *arg_t)
324
324
{
325
325
  if (!(this->*analyzer)(arg_p))
326
326
    return 0;
333
333
        The same parameter value of arg_p must be passed
334
334
        to analyze any argument of the condition formula.
335
335
      */   
336
 
      uchar *arg_v= *arg_p;
 
336
      unsigned char *arg_v= *arg_p;
337
337
      Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t);
338
338
      if (new_item && *arg != new_item)
339
339
        current_thd->change_item_tree(arg, new_item);
2592
2592
    return 0;
2593
2593
  }
2594
2594
  null_value=0;
2595
 
  return (int64_t) (res->length() ? (uchar) (*res)[0] : (uchar) 0);
 
2595
  return (int64_t) (res->length() ? (unsigned char) (*res)[0] : (unsigned char) 0);
2596
2596
}
2597
2597
 
2598
2598
int64_t Item_func_ord::val_int()
2612
2612
    register const char *str=res->ptr();
2613
2613
    register uint32_t n=0, l=my_ismbchar(res->charset(),str,str+res->length());
2614
2614
    if (!l)
2615
 
      return (int64_t)((uchar) *str);
 
2615
      return (int64_t)((unsigned char) *str);
2616
2616
    while (l--)
2617
 
      n=(n<<8)|(uint32_t)((uchar) *str++);
 
2617
      n=(n<<8)|(uint32_t)((unsigned char) *str++);
2618
2618
    return (int64_t) n;
2619
2619
  }
2620
2620
#endif
2621
 
  return (int64_t) ((uchar) (*res)[0]);
 
2621
  return (int64_t) ((unsigned char) (*res)[0]);
2622
2622
}
2623
2623
 
2624
2624
        /* Search after a string in a string of strings separated by ',' */
2665
2665
    const char *str_begin= buffer->ptr();
2666
2666
    const char *str_end= buffer->ptr();
2667
2667
    const char *real_end= str_end+buffer->length();
2668
 
    const uchar *find_str= (const uchar *) find->ptr();
 
2668
    const unsigned char *find_str= (const unsigned char *) find->ptr();
2669
2669
    uint find_str_len= find->length();
2670
2670
    int position= 0;
2671
2671
    while (1)
2672
2672
    {
2673
2673
      int symbol_len;
2674
 
      if ((symbol_len= cs->cset->mb_wc(cs, &wc, (uchar*) str_end, 
2675
 
                                       (uchar*) real_end)) > 0)
 
2674
      if ((symbol_len= cs->cset->mb_wc(cs, &wc, (unsigned char*) str_end, 
 
2675
                                       (unsigned char*) real_end)) > 0)
2676
2676
      {
2677
2677
        const char *substr_end= str_end + symbol_len;
2678
2678
        bool is_last_item= (substr_end == real_end);
2682
2682
          position++;
2683
2683
          if (is_last_item && !is_separator)
2684
2684
            str_end= substr_end;
2685
 
          if (!my_strnncoll(cs, (const uchar *) str_begin,
 
2685
          if (!my_strnncoll(cs, (const unsigned char *) str_begin,
2686
2686
                            str_end - str_begin,
2687
2687
                            find_str, find_str_len))
2688
2688
            return (int64_t) position;
2720
2720
 
2721
2721
class User_level_lock
2722
2722
{
2723
 
  uchar *key;
 
2723
  unsigned char *key;
2724
2724
  size_t key_length;
2725
2725
 
2726
2726
public:
2730
2730
  my_thread_id thread_id;
2731
2731
  void set_thread(THD *thd) { thread_id= thd->thread_id; }
2732
2732
 
2733
 
  User_level_lock(const uchar *key_arg,uint length, ulong id) 
 
2733
  User_level_lock(const unsigned char *key_arg,uint length, ulong id) 
2734
2734
    :key_length(length),count(1),locked(1), thread_id(id)
2735
2735
  {
2736
 
    key= (uchar*) my_memdup(key_arg,length,MYF(0));
 
2736
    key= (unsigned char*) my_memdup(key_arg,length,MYF(0));
2737
2737
    pthread_cond_init(&cond,NULL);
2738
2738
    if (key)
2739
2739
    {
2740
 
      if (my_hash_insert(&hash_user_locks,(uchar*) this))
 
2740
      if (my_hash_insert(&hash_user_locks,(unsigned char*) this))
2741
2741
      {
2742
2742
        free(key);
2743
2743
        key=0;
2748
2748
  {
2749
2749
    if (key)
2750
2750
    {
2751
 
      hash_delete(&hash_user_locks,(uchar*) this);
 
2751
      hash_delete(&hash_user_locks,(unsigned char*) this);
2752
2752
      free(key);
2753
2753
    }
2754
2754
    pthread_cond_destroy(&cond);
2755
2755
  }
2756
2756
  inline bool initialized() { return key != 0; }
2757
2757
  friend void item_user_lock_release(User_level_lock *ull);
2758
 
  friend uchar *ull_get_key(const User_level_lock *ull, size_t *length,
 
2758
  friend unsigned char *ull_get_key(const User_level_lock *ull, size_t *length,
2759
2759
                            bool not_used);
2760
2760
};
2761
2761
 
2762
 
uchar *ull_get_key(const User_level_lock *ull, size_t *length,
 
2762
unsigned char *ull_get_key(const User_level_lock *ull, size_t *length,
2763
2763
                   bool not_used __attribute__((unused)))
2764
2764
{
2765
2765
  *length= ull->key_length;
2934
2934
{
2935
2935
  user_var_entry *entry;
2936
2936
 
2937
 
  if (!(entry = (user_var_entry*) hash_search(hash, (uchar*) name.str,
 
2937
  if (!(entry = (user_var_entry*) hash_search(hash, (unsigned char*) name.str,
2938
2938
                                              name.length)) &&
2939
2939
      create_if_not_exists)
2940
2940
  {
2964
2964
    entry->used_query_id=current_thd->query_id;
2965
2965
    entry->type=STRING_RESULT;
2966
2966
    memcpy(entry->name.str, name.str, name.length+1);
2967
 
    if (my_hash_insert(hash,(uchar*) entry))
 
2967
    if (my_hash_insert(hash,(unsigned char*) entry))
2968
2968
    {
2969
2969
      free((char*) entry);
2970
2970
      return 0;
3033
3033
    column read set or to register used fields in a view
3034
3034
*/
3035
3035
 
3036
 
bool Item_func_set_user_var::register_field_in_read_map(uchar *arg)
 
3036
bool Item_func_set_user_var::register_field_in_read_map(unsigned char *arg)
3037
3037
{
3038
3038
  if (result_field)
3039
3039
  {
3763
3763
  }
3764
3764
  /* Mark that this variable has been used by this query */
3765
3765
  var_entry->used_query_id= thd->query_id;
3766
 
  if (insert_dynamic(&thd->user_var_events, (uchar*) &user_var_event))
 
3766
  if (insert_dynamic(&thd->user_var_events, (unsigned char*) &user_var_event))
3767
3767
    goto err;
3768
3768
 
3769
3769
  *out_entry= var_entry;
4060
4060
  }
4061
4061
  
4062
4062
  pthread_mutex_lock(&LOCK_user_locks);
4063
 
  ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(),
 
4063
  ull= (User_level_lock *) hash_search(&hash_user_locks, (unsigned char*) res->ptr(),
4064
4064
                                       (size_t) res->length());
4065
4065
  pthread_mutex_unlock(&LOCK_user_locks);
4066
4066
  if (!ull || !ull->locked)
4079
4079
    return 0;
4080
4080
  
4081
4081
  pthread_mutex_lock(&LOCK_user_locks);
4082
 
  ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(),
 
4082
  ull= (User_level_lock *) hash_search(&hash_user_locks, (unsigned char*) res->ptr(),
4083
4083
                                       (size_t) res->length());
4084
4084
  pthread_mutex_unlock(&LOCK_user_locks);
4085
4085
  if (!ull || !ull->locked)