~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.cc

  • Committer: Brian Aker
  • Date: 2011-03-28 02:46:21 UTC
  • Revision ID: brian@tangent.org-20110328024621-wtkdtlvdplqm0ybf
Shift CHARSET_INFO to charset_info_st

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
  (void) real_alloc(length_arg);
69
69
}
70
70
 
71
 
String::String(const char *str, const CHARSET_INFO * const cs)
 
71
String::String(const char *str, const charset_info_st * const cs)
72
72
  : Ptr(const_cast<char *>(str)),
73
73
    str_length(static_cast<size_t>(strlen(str))),
74
74
    Alloced_length(0),
77
77
{ }
78
78
 
79
79
 
80
 
String::String(const char *str, size_t len, const CHARSET_INFO * const cs)
 
80
String::String(const char *str, size_t len, const charset_info_st * const cs)
81
81
  : Ptr(const_cast<char *>(str)),
82
82
    str_length(len),
83
83
    Alloced_length(0),
86
86
{ }
87
87
 
88
88
 
89
 
String::String(char *str, size_t len, const CHARSET_INFO * const cs)
 
89
String::String(char *str, size_t len, const charset_info_st * const cs)
90
90
  : Ptr(str),
91
91
    str_length(len),
92
92
    Alloced_length(len),
166
166
  return false;
167
167
}
168
168
 
169
 
bool String::set_int(int64_t num, bool unsigned_flag, const CHARSET_INFO * const cs)
 
169
bool String::set_int(int64_t num, bool unsigned_flag, const charset_info_st * const cs)
170
170
{
171
171
  size_t l=20*cs->mbmaxlen+1;
172
172
  int base= unsigned_flag ? 10 : -10;
178
178
  return false;
179
179
}
180
180
 
181
 
bool String::set_real(double num,size_t decimals, const CHARSET_INFO * const cs)
 
181
bool String::set_real(double num,size_t decimals, const charset_info_st * const cs)
182
182
{
183
183
  char buff[FLOATING_POINT_BUFFER];
184
184
  size_t dummy_errors;
219
219
  return false;
220
220
}
221
221
 
222
 
bool String::copy(const std::string& arg, const CHARSET_INFO * const cs)        // Allocate new string
 
222
bool String::copy(const std::string& arg, const charset_info_st * const cs)     // Allocate new string
223
223
{
224
224
  if (alloc(arg.size()))
225
225
    return true;
233
233
  return false;
234
234
}
235
235
 
236
 
bool String::copy(const char *str,size_t arg_length, const CHARSET_INFO * const cs)
 
236
bool String::copy(const char *str,size_t arg_length, const charset_info_st * const cs)
237
237
{
238
238
  if (alloc(arg_length))
239
239
    return true;
267
267
*/
268
268
 
269
269
bool String::needs_conversion(size_t arg_length,
270
 
                              const CHARSET_INFO * const from_cs,
271
 
                              const CHARSET_INFO * const to_cs,
 
270
                              const charset_info_st * const from_cs,
 
271
                              const charset_info_st * const to_cs,
272
272
                              size_t *offset)
273
273
{
274
274
  *offset= 0;
286
286
 
287
287
 
288
288
bool String::set_or_copy_aligned(const char *str,size_t arg_length,
289
 
                                 const CHARSET_INFO * const cs)
 
289
                                 const charset_info_st * const cs)
290
290
{
291
291
  /* How many bytes are in incomplete character */
292
292
  size_t offset= (arg_length % cs->mbminlen);
300
300
        /* Copy with charset conversion */
301
301
 
302
302
bool String::copy(const char *str, size_t arg_length,
303
 
                          const CHARSET_INFO * const,
304
 
                                  const CHARSET_INFO * const to_cs, size_t *errors)
 
303
                          const charset_info_st * const,
 
304
                                  const charset_info_st * const to_cs, size_t *errors)
305
305
{
306
306
  *errors= 0;
307
307
  return copy(str, arg_length, to_cs);
386
386
  with character set recoding
387
387
*/
388
388
 
389
 
bool String::append(const char *s,size_t arg_length, const CHARSET_INFO * const)
 
389
bool String::append(const char *s,size_t arg_length, const charset_info_st * const)
390
390
{
391
391
  if (realloc(str_length + arg_length))
392
392
    return true;
546
546
*/
547
547
 
548
548
 
549
 
int sortcmp(const String *s,const String *t, const CHARSET_INFO * const cs)
 
549
int sortcmp(const String *s,const String *t, const charset_info_st * const cs)
550
550
{
551
551
 return cs->coll->strnncollsp(cs,
552
552
                              (unsigned char *) s->ptr(),s->length(),
630
630
 
631
631
 
632
632
size_t
633
 
well_formed_copy_nchars(const CHARSET_INFO * const to_cs,
 
633
well_formed_copy_nchars(const charset_info_st * const to_cs,
634
634
                        char *to, size_t to_length,
635
 
                        const CHARSET_INFO * const from_cs,
 
635
                        const charset_info_st * const from_cs,
636
636
                        const char *from, size_t from_length,
637
637
                        size_t nchars,
638
638
                        const char **well_formed_error_pos,
745
745
*/
746
746
 
747
747
/* Factor the extern out */
748
 
extern const CHARSET_INFO *system_charset_info, *files_charset_info;
 
748
extern const charset_info_st *system_charset_info, *files_charset_info;
749
749
 
750
750
void String::append_identifier(const char *name, size_t in_length)
751
751
{
827
827
{
828
828
  int8store(Ptr + position,value);
829
829
}
830
 
bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str,
 
830
bool check_if_only_end_space(const charset_info_st * const cs, char *str,
831
831
                             char *end)
832
832
{
833
833
  return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;