~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
/* This file is originally from the mysql distribution. Coded by monty */
24
24
 
25
25
#include <drizzled/common.h>
 
26
 
26
27
#include <cassert>
27
28
#include <cstdlib>
28
29
#include <cstring>
29
30
#include <string>
30
31
 
 
32
#include <drizzled/visibility.h>
 
33
 
31
34
#ifndef NOT_FIXED_DEC
32
35
#define NOT_FIXED_DEC                   (uint8_t)31
33
36
#endif
37
40
 
38
41
class String;
39
42
 
40
 
extern String my_empty_string;
 
43
extern DRIZZLED_API String my_empty_string;
41
44
extern const String my_null_string;
42
45
namespace memory { class Root; }
43
46
typedef struct charset_info_st CHARSET_INFO;
44
47
 
45
 
std::string String_to_std_string(String const& s);
46
 
String* set_String_from_std_string(String* s, std::string const& cs);
 
48
DRIZZLED_API std::string String_to_std_string(String const& s);
 
49
DRIZZLED_API String* set_String_from_std_string(String* s, std::string const& cs);
47
50
 
48
51
int sortcmp(const String *a,const String *b, const CHARSET_INFO * const cs);
49
52
int stringcmp(const String *a,const String *b);
58
61
                                 const char **from_end_pos);
59
62
 
60
63
 
61
 
class String
 
64
class DRIZZLED_API String
62
65
{
63
66
  char *Ptr;
64
67
  size_t str_length,Alloced_length;
217
220
      char *new_ptr;
218
221
      if (!(new_ptr= reinterpret_cast<char*>(::realloc(Ptr,arg_length))))
219
222
      {
220
 
        Alloced_length = 0;
221
 
        real_alloc(arg_length);
 
223
        Alloced_length = 0;
 
224
        real_alloc(arg_length);
222
225
      }
223
226
      else
224
227
      {
225
 
        Ptr=new_ptr;
226
 
        Alloced_length=arg_length;
 
228
        Ptr=new_ptr;
 
229
        Alloced_length=arg_length;
227
230
      }
228
231
    }
229
232
  }
246
249
 
247
250
  bool copy();                                  // Alloc string if not alloced
248
251
  bool copy(const String &s);                   // Allocate new string
 
252
  bool copy(const std::string&, const CHARSET_INFO * const cs); // Allocate new string
249
253
  bool copy(const char *s,size_t arg_length, const CHARSET_INFO * const cs);    // Allocate new string
250
254
  static bool needs_conversion(size_t arg_length,
251
255
                               const CHARSET_INFO * const cs_from, const CHARSET_INFO * const cs_to,
252
256
                               size_t *offset);
253
257
  bool set_or_copy_aligned(const char *s, size_t arg_length, const CHARSET_INFO * const cs);
254
258
  bool copy(const char*s,size_t arg_length, const CHARSET_INFO * const csfrom,
255
 
            const CHARSET_INFO * const csto, size_t *errors);
 
259
            const CHARSET_INFO * const csto, size_t *errors);
256
260
  bool append(const String &s);
257
261
  bool append(const char *s);
258
262
  bool append(const char *s,size_t arg_length);
272
276
    else
273
277
    {
274
278
      if (realloc(str_length+1))
275
 
        return 1;
 
279
        return 1;
276
280
      Ptr[str_length++]=chr;
277
281
    }
278
282
    return 0;
339
343
bool check_if_only_end_space(const CHARSET_INFO * const cs, char *str,
340
344
                             char *end);
341
345
 
 
346
std::ostream& operator<<(std::ostream& output, const String &str);
 
347
 
342
348
} /* namespace drizzled */
343
349
 
344
350
bool operator==(const drizzled::String &s1, const drizzled::String &s2);