~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.h

  • Committer: Mark Atwood
  • Date: 2008-10-16 11:33:16 UTC
  • mto: (520.1.13 drizzle)
  • mto: This revision was merged to the branch mainline in revision 530.
  • Revision ID: mark@fallenpegasus.com-20081016113316-ff6jdt31ck90sjdh
an implemention of the errmsg plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 */
 
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
 */
15
19
 
16
20
#ifndef DRIZZLE_SERVER_SQL_STRING_H
17
21
#define DRIZZLE_SERVER_SQL_STRING_H
18
22
 
19
23
/* This file is originally from the mysql distribution. Coded by monty */
20
24
 
21
 
#ifdef USE_PRAGMA_INTERFACE
22
 
#pragma interface                       /* gcc class implementation */
23
 
#endif
24
25
 
25
26
#ifndef NOT_FIXED_DEC
26
27
#define NOT_FIXED_DEC                   31
27
28
#endif
28
29
 
 
30
#include <libdrizzle/drizzle_com.h>
 
31
#include <mysys/iocache.h>
 
32
 
29
33
class String;
30
34
int sortcmp(const String *a,const String *b, const CHARSET_INFO * const cs);
31
35
String *copy_if_not_alloced(String *a,String *b,uint32_t arg_length);
32
36
uint32_t copy_and_convert(char *to, uint32_t to_length, const CHARSET_INFO * const to_cs,
33
37
                        const char *from, uint32_t from_length,
34
 
                        const CHARSET_INFO * const from_cs, uint *errors);
 
38
                        const CHARSET_INFO * const from_cs, uint32_t *errors);
35
39
uint32_t well_formed_copy_nchars(const CHARSET_INFO * const to_cs,
36
 
                               char *to, uint to_length,
 
40
                               char *to, uint32_t to_length,
37
41
                               const CHARSET_INFO * const from_cs,
38
 
                               const char *from, uint from_length,
39
 
                               uint nchars,
 
42
                               const char *from, uint32_t from_length,
 
43
                               uint32_t nchars,
40
44
                               const char **well_formed_error_pos,
41
45
                               const char **cannot_convert_error_pos,
42
46
                               const char **from_end_pos);
161
165
  { return set_int(num, false, cs); }
162
166
  bool set(uint64_t num, const CHARSET_INFO * const cs)
163
167
  { return set_int((int64_t)num, true, cs); }
164
 
  bool set_real(double num,uint decimals, const CHARSET_INFO * const cs);
 
168
  bool set_real(double num,uint32_t decimals, const CHARSET_INFO * const cs);
165
169
 
166
170
  /*
167
171
    PMG 2004.11.12
196
200
    {
197
201
      alloced=0;
198
202
      Alloced_length=0;
199
 
      my_free(Ptr,MYF(0));
 
203
      ::free(Ptr);
200
204
      Ptr=0;
201
205
      str_length=0;                             /* Safety */
202
206
    }
253
257
                    const CHARSET_INFO * const cs);
254
258
  bool set_or_copy_aligned(const char *s, uint32_t arg_length, const CHARSET_INFO * const cs);
255
259
  bool copy(const char*s,uint32_t arg_length, const CHARSET_INFO * const csfrom,
256
 
            const CHARSET_INFO * const csto, uint *errors);
 
260
            const CHARSET_INFO * const csto, uint32_t *errors);
257
261
  bool append(const String &s);
258
262
  bool append(const char *s);
259
263
  bool append(const char *s,uint32_t arg_length);
336
340
     str_length++;
337
341
  }
338
342
  void qs_append(int i);
339
 
  void qs_append(uint i);
 
343
  void qs_append(uint32_t i);
340
344
 
341
345
  /* Inline (general) functions used by the protocol functions */
342
346