~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.cc

  • Committer: Monty Taylor
  • Date: 2009-12-22 22:13:48 UTC
  • mto: This revision was merged to the branch mainline in revision 1253.
  • Revision ID: mordred@inaugust.com-20091222221348-9ke4pivswdwf0y02
More mysys stuff out of headers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
** String functions
39
39
*****************************************************************************/
40
40
 
 
41
String::String()
 
42
  : Ptr(0),
 
43
    str_length(0),
 
44
    Alloced_length(0),
 
45
    alloced(0),
 
46
    str_charset(&my_charset_bin)
 
47
{ }
 
48
 
 
49
String::String(uint32_t length_arg)
 
50
  : Ptr(0),
 
51
    str_length(0),
 
52
    Alloced_length(0),
 
53
    alloced(0),
 
54
    str_charset(&my_charset_bin)
 
55
{
 
56
  (void) real_alloc(length_arg);
 
57
}
 
58
 
 
59
String::String(const char *str, const CHARSET_INFO * const cs)
 
60
  : Ptr(const_cast<char*>(str)),
 
61
    str_length(static_cast<uint32_t>(strlen(str))),
 
62
    Alloced_length(0),
 
63
    alloced(0),
 
64
    str_charset(cs)
 
65
{ }
 
66
 
 
67
String::String(const char *str, uint32_t len, const CHARSET_INFO * const cs)
 
68
  : Ptr(const_cast<char*>(str)),
 
69
    str_length(len),
 
70
    Alloced_length(0),
 
71
    alloced(0),
 
72
    str_charset(cs)
 
73
{ }
 
74
 
 
75
String::String(char *str,uint32_t len, const CHARSET_INFO * const cs)
 
76
  : Ptr(str),
 
77
    str_length(len),
 
78
    Alloced_length(len),
 
79
    alloced(0),
 
80
    str_charset(cs)
 
81
{ }
 
82
 
 
83
String::String(const String &str)
 
84
  : Ptr(str.Ptr),
 
85
    str_length(str.str_length),
 
86
    Alloced_length(str.Alloced_length),
 
87
    alloced(0),
 
88
    str_charset(str.str_charset)
 
89
{ }
 
90
 
 
91
void *String::operator new(size_t size, MEM_ROOT *mem_root)
 
92
{
 
93
  return alloc_root(mem_root, static_cast<uint32_t>(size));
 
94
}
 
95
 
41
96
String::~String() { free(); }
42
97
 
43
98
bool String::real_alloc(uint32_t arg_length)
725
780
  return !(s1 == s2);
726
781
}
727
782
 
 
783
bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str,
 
784
                             char *end)
 
785
{
 
786
  return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end;
 
787
}