~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.h

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
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
/* Copyright (C) 2000 MySQL AB
 
2
 
 
3
   This program is free software; you can redistribute it and/or modify
 
4
   it under the terms of the GNU General Public License as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
19
15
 
20
16
#ifndef DRIZZLE_SERVER_SQL_STRING_H
21
17
#define DRIZZLE_SERVER_SQL_STRING_H
22
18
 
23
19
/* This file is originally from the mysql distribution. Coded by monty */
24
20
 
 
21
#ifdef USE_PRAGMA_INTERFACE
 
22
#pragma interface                       /* gcc class implementation */
 
23
#endif
25
24
 
26
25
#ifndef NOT_FIXED_DEC
27
26
#define NOT_FIXED_DEC                   31
28
27
#endif
29
28
 
30
 
#include <drizzled/common.h>
31
 
#include <mysys/iocache.h>
32
 
 
33
29
class String;
34
30
int sortcmp(const String *a,const String *b, const CHARSET_INFO * const cs);
35
31
String *copy_if_not_alloced(String *a,String *b,uint32_t arg_length);
36
32
uint32_t copy_and_convert(char *to, uint32_t to_length, const CHARSET_INFO * const to_cs,
37
33
                        const char *from, uint32_t from_length,
38
 
                        const CHARSET_INFO * const from_cs, uint32_t *errors);
 
34
                        const CHARSET_INFO * const from_cs, uint *errors);
39
35
uint32_t well_formed_copy_nchars(const CHARSET_INFO * const to_cs,
40
 
                               char *to, uint32_t to_length,
 
36
                               char *to, uint to_length,
41
37
                               const CHARSET_INFO * const from_cs,
42
 
                               const char *from, uint32_t from_length,
43
 
                               uint32_t nchars,
 
38
                               const char *from, uint from_length,
 
39
                               uint nchars,
44
40
                               const char **well_formed_error_pos,
45
41
                               const char **cannot_convert_error_pos,
46
42
                               const char **from_end_pos);
165
161
  { return set_int(num, false, cs); }
166
162
  bool set(uint64_t num, const CHARSET_INFO * const cs)
167
163
  { return set_int((int64_t)num, true, cs); }
168
 
  bool set_real(double num,uint32_t decimals, const CHARSET_INFO * const cs);
 
164
  bool set_real(double num,uint decimals, const CHARSET_INFO * const cs);
169
165
 
170
166
  /*
171
167
    PMG 2004.11.12
200
196
    {
201
197
      alloced=0;
202
198
      Alloced_length=0;
203
 
      ::free(Ptr);
 
199
      my_free(Ptr,MYF(0));
204
200
      Ptr=0;
205
201
      str_length=0;                             /* Safety */
206
202
    }
257
253
                    const CHARSET_INFO * const cs);
258
254
  bool set_or_copy_aligned(const char *s, uint32_t arg_length, const CHARSET_INFO * const cs);
259
255
  bool copy(const char*s,uint32_t arg_length, const CHARSET_INFO * const csfrom,
260
 
            const CHARSET_INFO * const csto, uint32_t *errors);
 
256
            const CHARSET_INFO * const csto, uint *errors);
261
257
  bool append(const String &s);
262
258
  bool append(const char *s);
263
259
  bool append(const char *s,uint32_t arg_length);
340
336
     str_length++;
341
337
  }
342
338
  void qs_append(int i);
343
 
  void qs_append(uint32_t i);
 
339
  void qs_append(uint i);
344
340
 
345
341
  /* Inline (general) functions used by the protocol functions */
346
342