~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/varstring.cc

  • Committer: Brian Aker
  • Date: 2010-03-31 05:53:34 UTC
  • Revision ID: brian@gaz-20100331055334-yqqmzlgqb2xq1p5b
Mass overhaul to use schema_identifier.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
                                 unsigned char *null_ptr_arg,
57
57
                                 unsigned char null_bit_arg,
58
58
                                 const char *field_name_arg,
59
 
                                 const CHARSET_INFO * const cs) :
60
 
  Field_str(ptr_arg,
61
 
            len_arg,
62
 
            null_ptr_arg,
63
 
            null_bit_arg,
64
 
            field_name_arg, cs),
65
 
length_bytes(length_bytes_arg)
 
59
                                 TableShare *share,
 
60
                                 const CHARSET_INFO * const cs)
 
61
  :Field_str(ptr_arg,
 
62
             len_arg,
 
63
             null_ptr_arg,
 
64
             null_bit_arg,
 
65
             field_name_arg, cs),
 
66
   length_bytes(length_bytes_arg)
66
67
{
 
68
  share->varchar_fields++;
67
69
}
68
70
 
69
71
Field_varstring::Field_varstring(uint32_t len_arg,
70
72
                                 bool maybe_null_arg,
71
73
                                 const char *field_name_arg,
72
 
                                 const CHARSET_INFO * const cs) :
73
 
  Field_str((unsigned char*) 0,
74
 
            len_arg,
75
 
            maybe_null_arg ? (unsigned char*) "": 0,
76
 
            0,
77
 
            field_name_arg,
78
 
            cs),
79
 
  length_bytes(len_arg < 256 ? 1 :2)
 
74
                                 TableShare *share,
 
75
                                 const CHARSET_INFO * const cs)
 
76
  :Field_str((unsigned char*) 0,
 
77
             len_arg,
 
78
             maybe_null_arg ? (unsigned char*) "": 0,
 
79
             0,
 
80
             field_name_arg,
 
81
             cs),
 
82
   length_bytes(len_arg < 256 ? 1 :2)
80
83
{
 
84
  share->varchar_fields++;
81
85
}
82
86
 
83
87
int Field_varstring::store(const char *from,uint32_t length, const CHARSET_INFO * const cs)
116
120
  char buff[64];
117
121
  uint32_t  length;
118
122
  length= (uint32_t) (field_charset->cset->int64_t10_to_str)(field_charset,
119
 
                                                             buff,
120
 
                                                             sizeof(buff),
121
 
                                                             (unsigned_val ? 10: -10),
122
 
                                                             nr);
 
123
                                                          buff,
 
124
                                                          sizeof(buff),
 
125
                                                          (unsigned_val ? 10:
 
126
                                                           -10),
 
127
                                                           nr);
123
128
  return Field_varstring::store(buff, length, field_charset);
124
129
}
125
130
 
219
224
  uint32_t local_char_length= max_key_length / field_charset->mbmaxlen;
220
225
 
221
226
  local_char_length= my_charpos(field_charset, ptr + length_bytes,
222
 
                                ptr + length_bytes + length, local_char_length);
 
227
                          ptr + length_bytes + length, local_char_length);
223
228
  set_if_smaller(length, local_char_length);
224
229
  return field_charset->coll->strnncollsp(field_charset,
225
230
                                          ptr + length_bytes,
264
269
  }
265
270
 
266
271
  tot_length= my_strnxfrm(field_charset,
267
 
                          to, length, ptr + length_bytes,
268
 
                          tot_length);
 
272
                          to, length, ptr + length_bytes,
 
273
                          tot_length);
269
274
  assert(tot_length == length);
270
275
}
271
276