390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008 Sun Microsystems, Inc.
|
390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
20 |
#pragma once
|
243.1.5
by Jay Pipes
* Pulled the remainder of the log and parse stuff out into |
21 |
|
1
by brian
clean slate |
22 |
/* This file is originally from the mysql distribution. Coded by monty */
|
23 |
||
543
by Monty Taylor
Renamed drizzle_common again. Removed sql_common. (empty) |
24 |
#include <drizzled/common.h> |
2154.2.3
by Brian Aker
Update headers (more removal of session). |
25 |
|
1241.9.51
by Monty Taylor
More mysys stuff out of headers. |
26 |
#include <cassert> |
27 |
#include <cstdlib> |
|
28 |
#include <cstring> |
|
1271.2.4
by Tim Penhey
Add some standard converstion functions. |
29 |
#include <string> |
390.1.6
by Monty Taylor
Oh dear god the changes. The changes. I'd tell you what they are, but I'd just be making stuff up. Suffice it to day it's mostly all around splitting files in libdrizzle into different files and removing interdepends. And whatever else I happened to see... |
30 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
31 |
#include <drizzled/visibility.h> |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
32 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
33 |
#ifndef NOT_FIXED_DEC
|
34 |
#define NOT_FIXED_DEC (uint8_t)31
|
|
35 |
#endif
|
|
36 |
||
37 |
namespace drizzled |
|
38 |
{
|
|
39 |
||
1
by brian
clean slate |
40 |
class String; |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
41 |
|
2119.4.3
by Monty Taylor
We want to add visibility markers into the headers... not take them away |
42 |
extern DRIZZLED_API String my_empty_string; |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
43 |
extern const String my_null_string; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
44 |
namespace memory { class Root; } |
1241.9.51
by Monty Taylor
More mysys stuff out of headers. |
45 |
typedef struct charset_info_st CHARSET_INFO; |
1241.9.12
by Monty Taylor
Trims more out of server_includes.h. |
46 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
47 |
DRIZZLED_API std::string String_to_std_string(String const& s); |
48 |
DRIZZLED_API String* set_String_from_std_string(String* s, std::string const& cs); |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
49 |
|
50 |
int sortcmp(const String *a,const String *b, const CHARSET_INFO * const cs); |
|
51 |
int stringcmp(const String *a,const String *b); |
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
52 |
String *copy_if_not_alloced(String *a,String *b,size_t arg_length); |
53 |
size_t well_formed_copy_nchars(const CHARSET_INFO * const to_cs, |
|
54 |
char *to, size_t to_length, |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
55 |
const CHARSET_INFO * const from_cs, |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
56 |
const char *from, size_t from_length, |
57 |
size_t nchars, |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
58 |
const char **well_formed_error_pos, |
59 |
const char **cannot_convert_error_pos, |
|
60 |
const char **from_end_pos); |
|
61 |
||
1
by brian
clean slate |
62 |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
63 |
class DRIZZLED_API String |
1
by brian
clean slate |
64 |
{
|
511.2.4
by Monty Taylor
Fixed warnings before we got to sql_yacc. |
65 |
char *Ptr; |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
66 |
size_t str_length,Alloced_length; |
1
by brian
clean slate |
67 |
bool alloced; |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
68 |
const CHARSET_INFO *str_charset; |
794
by Brian Aker
Refactor append_identifier and remove dead OPTION_QUOTE_SHOW_CREATE option |
69 |
|
1
by brian
clean slate |
70 |
public: |
1241.16.2
by Monty Taylor
Cleaned effc++ warnings from sql_string. |
71 |
String(); |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
72 |
String(size_t length_arg); |
1241.16.2
by Monty Taylor
Cleaned effc++ warnings from sql_string. |
73 |
String(const char *str, const CHARSET_INFO * const cs); |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
74 |
String(const char *str, size_t len, const CHARSET_INFO * const cs); |
75 |
String(char *str, size_t len, const CHARSET_INFO * const cs); |
|
1241.16.2
by Monty Taylor
Cleaned effc++ warnings from sql_string. |
76 |
String(const String &str); |
77 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
78 |
static void *operator new(size_t size, memory::Root *mem_root); |
1241.16.2
by Monty Taylor
Cleaned effc++ warnings from sql_string. |
79 |
static void operator delete(void *, size_t) |
80 |
{ } |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
81 |
static void operator delete(void *, memory::Root *) |
1241.16.2
by Monty Taylor
Cleaned effc++ warnings from sql_string. |
82 |
{ } |
1022.2.29
by Monty Taylor
Fixed some no-inline warnings. |
83 |
~String(); |
1
by brian
clean slate |
84 |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
85 |
inline void set_charset(const CHARSET_INFO * const charset_arg) |
1
by brian
clean slate |
86 |
{ str_charset= charset_arg; } |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
87 |
inline const CHARSET_INFO *charset() const { return str_charset; } |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
88 |
inline size_t length() const { return str_length;} |
89 |
inline size_t alloced_length() const { return Alloced_length;} |
|
90 |
inline char& operator [] (size_t i) const { return Ptr[i]; } |
|
91 |
inline void length(size_t len) { str_length=len ; } |
|
1
by brian
clean slate |
92 |
inline bool is_empty() { return (str_length == 0); } |
93 |
inline void mark_as_const() { Alloced_length= 0;} |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
94 |
inline char *ptr() { return Ptr; } |
1
by brian
clean slate |
95 |
inline const char *ptr() const { return Ptr; } |
96 |
inline char *c_ptr() |
|
97 |
{
|
|
1022.5.1
by nlw
Fix buffer overrun in string::c_ptr, now handles all cases properly |
98 |
if (str_length == Alloced_length) |
1
by brian
clean slate |
99 |
(void) realloc(str_length); |
1022.5.1
by nlw
Fix buffer overrun in string::c_ptr, now handles all cases properly |
100 |
else
|
101 |
Ptr[str_length]= 0; |
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
102 |
|
1
by brian
clean slate |
103 |
return Ptr; |
104 |
}
|
|
105 |
inline char *c_ptr_quick() |
|
106 |
{
|
|
107 |
if (Ptr && str_length < Alloced_length) |
|
108 |
Ptr[str_length]=0; |
|
109 |
return Ptr; |
|
110 |
}
|
|
111 |
inline char *c_ptr_safe() |
|
112 |
{
|
|
113 |
if (Ptr && str_length < Alloced_length) |
|
114 |
Ptr[str_length]=0; |
|
115 |
else
|
|
116 |
(void) realloc(str_length); |
|
117 |
return Ptr; |
|
118 |
}
|
|
1273.13.38
by Brian Aker
Add in new show work. |
119 |
inline char *c_str() |
120 |
{
|
|
121 |
if (Ptr && str_length < Alloced_length) |
|
122 |
Ptr[str_length]=0; |
|
123 |
else
|
|
124 |
(void) realloc(str_length); |
|
125 |
return Ptr; |
|
126 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
127 |
void append_identifier(const char *name, size_t length); |
1
by brian
clean slate |
128 |
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
129 |
void set(String &str,size_t offset,size_t arg_length) |
1
by brian
clean slate |
130 |
{
|
51.1.75
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
131 |
assert(&str != this); |
1
by brian
clean slate |
132 |
free(); |
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
133 |
Ptr= str.ptr()+offset; str_length=arg_length; alloced=0; |
1
by brian
clean slate |
134 |
if (str.Alloced_length) |
135 |
Alloced_length=str.Alloced_length-offset; |
|
136 |
else
|
|
137 |
Alloced_length=0; |
|
138 |
str_charset=str.str_charset; |
|
139 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
140 |
inline void set(char *str,size_t arg_length, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
141 |
{
|
142 |
free(); |
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
143 |
Ptr= str; str_length=Alloced_length=arg_length ; alloced=0; |
1
by brian
clean slate |
144 |
str_charset=cs; |
145 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
146 |
inline void set(const char *str,size_t arg_length, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
147 |
{
|
148 |
free(); |
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
149 |
Ptr= const_cast<char*>(str); |
150 |
str_length=arg_length; Alloced_length=0 ; alloced=0; |
|
1
by brian
clean slate |
151 |
str_charset=cs; |
152 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
153 |
bool set_ascii(const char *str, size_t arg_length); |
154 |
inline void set_quick(char *str,size_t arg_length, const CHARSET_INFO * const cs) |
|
1
by brian
clean slate |
155 |
{
|
156 |
if (!alloced) |
|
157 |
{
|
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
158 |
Ptr= str; str_length= Alloced_length= arg_length; |
1
by brian
clean slate |
159 |
}
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
160 |
str_charset= cs; |
1
by brian
clean slate |
161 |
}
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
162 |
bool set_int(int64_t num, bool unsigned_flag, const CHARSET_INFO * const cs); |
163 |
bool set(int64_t num, const CHARSET_INFO * const cs) |
|
1
by brian
clean slate |
164 |
{ return set_int(num, false, cs); } |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
165 |
bool set(uint64_t num, const CHARSET_INFO * const cs) |
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
166 |
{ return set_int(static_cast<int64_t>(num), true, cs); } |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
167 |
bool set_real(double num,size_t decimals, const CHARSET_INFO * const cs); |
1
by brian
clean slate |
168 |
|
169 |
/*
|
|
170 |
PMG 2004.11.12
|
|
171 |
This is a method that works the same as perl's "chop". It simply
|
|
172 |
drops the last character of a string. This is useful in the case
|
|
173 |
of the federated storage handler where I'm building a unknown
|
|
174 |
number, list of values and fields to be used in a sql insert
|
|
175 |
statement to be run on the remote server, and have a comma after each.
|
|
176 |
When the list is complete, I "chop" off the trailing comma
|
|
177 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
178 |
ex.
|
179 |
String stringobj;
|
|
1
by brian
clean slate |
180 |
stringobj.append("VALUES ('foo', 'fi', 'fo',");
|
181 |
stringobj.chop();
|
|
182 |
stringobj.append(")");
|
|
183 |
||
184 |
In this case, the value of string was:
|
|
185 |
||
186 |
VALUES ('foo', 'fi', 'fo',
|
|
187 |
VALUES ('foo', 'fi', 'fo'
|
|
188 |
VALUES ('foo', 'fi', 'fo')
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
189 |
|
1
by brian
clean slate |
190 |
*/
|
191 |
inline void chop() |
|
192 |
{
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
193 |
Ptr[str_length--]= '\0'; |
1
by brian
clean slate |
194 |
}
|
195 |
||
196 |
inline void free() |
|
197 |
{
|
|
198 |
if (alloced) |
|
199 |
{
|
|
200 |
alloced=0; |
|
201 |
Alloced_length=0; |
|
477
by Monty Taylor
Removed my_free(). It turns out that it had been def'd to ignore the flags passed to it in the second arg anyway. Gotta love that. |
202 |
::free(Ptr); |
1
by brian
clean slate |
203 |
Ptr=0; |
204 |
str_length=0; /* Safety */ |
|
205 |
}
|
|
206 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
207 |
inline bool alloc(size_t arg_length) |
1
by brian
clean slate |
208 |
{
|
209 |
if (arg_length < Alloced_length) |
|
210 |
return 0; |
|
211 |
return real_alloc(arg_length); |
|
212 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
213 |
bool real_alloc(size_t arg_length); // Empties old string |
214 |
bool realloc(size_t arg_length); |
|
215 |
inline void shrink(size_t arg_length) // Shrink buffer |
|
1
by brian
clean slate |
216 |
{
|
217 |
if (arg_length < Alloced_length) |
|
218 |
{
|
|
219 |
char *new_ptr; |
|
1241.3.4
by Trond Norbye
Cleanup: use C++ style casting, init-list and virtual destructors |
220 |
if (!(new_ptr= reinterpret_cast<char*>(::realloc(Ptr,arg_length)))) |
1
by brian
clean slate |
221 |
{
|
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
222 |
Alloced_length = 0; |
223 |
real_alloc(arg_length); |
|
1
by brian
clean slate |
224 |
}
|
225 |
else
|
|
226 |
{
|
|
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
227 |
Ptr=new_ptr; |
228 |
Alloced_length=arg_length; |
|
1
by brian
clean slate |
229 |
}
|
230 |
}
|
|
231 |
}
|
|
232 |
bool is_alloced() { return alloced; } |
|
233 |
inline String& operator = (const String &s) |
|
234 |
{
|
|
235 |
if (&s != this) |
|
236 |
{
|
|
237 |
/*
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
238 |
It is forbidden to do assignments like
|
1
by brian
clean slate |
239 |
some_string = substring_of_that_string
|
240 |
*/
|
|
51.1.75
by Jay Pipes
Standardized TRUE/FALSE, removed/replaced DBUG symbols |
241 |
assert(!s.uses_buffer_owned_by(this)); |
1
by brian
clean slate |
242 |
free(); |
243 |
Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length; |
|
244 |
alloced=0; |
|
245 |
}
|
|
246 |
return *this; |
|
247 |
}
|
|
248 |
||
249 |
bool copy(); // Alloc string if not alloced |
|
250 |
bool copy(const String &s); // Allocate new string |
|
2039.6.4
by Brian Aker
Merge in local_instance change. |
251 |
bool copy(const std::string&, const CHARSET_INFO * const cs); // Allocate new string |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
252 |
bool copy(const char *s,size_t arg_length, const CHARSET_INFO * const cs); // Allocate new string |
253 |
static bool needs_conversion(size_t arg_length, |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
254 |
const CHARSET_INFO * const cs_from, const CHARSET_INFO * const cs_to, |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
255 |
size_t *offset); |
256 |
bool set_or_copy_aligned(const char *s, size_t arg_length, const CHARSET_INFO * const cs); |
|
257 |
bool copy(const char*s,size_t arg_length, const CHARSET_INFO * const csfrom, |
|
2039.6.4
by Brian Aker
Merge in local_instance change. |
258 |
const CHARSET_INFO * const csto, size_t *errors); |
1
by brian
clean slate |
259 |
bool append(const String &s); |
260 |
bool append(const char *s); |
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
261 |
bool append(const char *s,size_t arg_length); |
262 |
bool append(const char *s,size_t arg_length, const CHARSET_INFO * const cs); |
|
263 |
bool append_with_prefill(const char *s, size_t arg_length, |
|
264 |
size_t full_length, char fill_char); |
|
265 |
int strstr(const String &search,size_t offset=0); // Returns offset to substring or -1 |
|
266 |
int strrstr(const String &search,size_t offset=0); // Returns offset to substring or -1 |
|
267 |
bool replace(size_t offset,size_t arg_length,const char *to,size_t length); |
|
268 |
bool replace(size_t offset,size_t arg_length,const String &to); |
|
1
by brian
clean slate |
269 |
inline bool append(char chr) |
270 |
{
|
|
271 |
if (str_length < Alloced_length) |
|
272 |
{
|
|
273 |
Ptr[str_length++]=chr; |
|
274 |
}
|
|
275 |
else
|
|
276 |
{
|
|
277 |
if (realloc(str_length+1)) |
|
2023.2.7
by Brian Aker
Create an Bool primtive type for item. |
278 |
return 1; |
1
by brian
clean slate |
279 |
Ptr[str_length++]=chr; |
280 |
}
|
|
281 |
return 0; |
|
282 |
}
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
283 |
friend int sortcmp(const String *a,const String *b, const CHARSET_INFO * const cs); |
1
by brian
clean slate |
284 |
friend int stringcmp(const String *a,const String *b); |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
285 |
friend String *copy_if_not_alloced(String *a,String *b,size_t arg_length); |
286 |
size_t numchars(); |
|
287 |
int charpos(int i,size_t offset=0); |
|
1
by brian
clean slate |
288 |
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
289 |
int reserve(size_t space_needed) |
1
by brian
clean slate |
290 |
{
|
291 |
return realloc(str_length + space_needed); |
|
292 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
293 |
int reserve(size_t space_needed, size_t grow_by); |
1
by brian
clean slate |
294 |
|
295 |
/*
|
|
296 |
The following append operations do NOT check alloced memory
|
|
297 |
q_*** methods writes values of parameters itself
|
|
298 |
qs_*** methods writes string representation of value
|
|
299 |
*/
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
300 |
void q_append(const char c); |
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
301 |
void q_append(const size_t n); |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
302 |
void q_append(double d); |
303 |
void q_append(double *d); |
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
304 |
void q_append(const char *data, size_t data_len); |
305 |
void write_at_position(int position, size_t value); |
|
1
by brian
clean slate |
306 |
|
307 |
/* Inline (general) functions used by the protocol functions */
|
|
308 |
||
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
309 |
inline char *prep_append(size_t arg_length, size_t step_alloc) |
1
by brian
clean slate |
310 |
{
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
311 |
size_t new_length= arg_length + str_length; |
1
by brian
clean slate |
312 |
if (new_length > Alloced_length) |
313 |
{
|
|
314 |
if (realloc(new_length + step_alloc)) |
|
315 |
return 0; |
|
316 |
}
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
317 |
size_t old_length= str_length; |
1
by brian
clean slate |
318 |
str_length+= arg_length; |
319 |
return Ptr+ old_length; /* Area to use */ |
|
320 |
}
|
|
321 |
||
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
322 |
inline bool append(const char *s, size_t arg_length, size_t step_alloc) |
1
by brian
clean slate |
323 |
{
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
324 |
size_t new_length= arg_length + str_length; |
1
by brian
clean slate |
325 |
if (new_length > Alloced_length && realloc(new_length + step_alloc)) |
163
by Brian Aker
Merge Monty's code. |
326 |
return true; |
1
by brian
clean slate |
327 |
memcpy(Ptr+str_length, s, arg_length); |
328 |
str_length+= arg_length; |
|
163
by Brian Aker
Merge Monty's code. |
329 |
return false; |
1
by brian
clean slate |
330 |
}
|
331 |
void print(String *print); |
|
332 |
||
333 |
/* Swap two string objects. Efficient way to exchange data without memcpy. */
|
|
334 |
void swap(String &s); |
|
335 |
||
336 |
inline bool uses_buffer_owned_by(const String *s) const |
|
337 |
{
|
|
338 |
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length); |
|
339 |
}
|
|
340 |
};
|
|
341 |
||
1241.9.51
by Monty Taylor
More mysys stuff out of headers. |
342 |
bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str, |
343 |
char *end); |
|
1
by brian
clean slate |
344 |
|
2023.2.1
by Brian Aker
Merge in BOOL type. |
345 |
std::ostream& operator<<(std::ostream& output, const String &str); |
346 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
347 |
} /* namespace drizzled */ |
348 |
||
349 |
bool operator==(const drizzled::String &s1, const drizzled::String &s2); |
|
350 |
bool operator!=(const drizzled::String &s1, const drizzled::String &s2); |
|
351 |
||
1
by brian
clean slate |
352 |