FreeTDS API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tdsstring.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20 #ifndef _tdsstring_h_
21 #define _tdsstring_h_
22
23 /* $Id: tdsstring.h,v 1.21 2010-01-25 23:05:59 freddy77 Exp $ */
24
25 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
26 #pragma GCC visibility push(hidden)
27 #endif
28
29 extern const char tds_str_empty[1];
30
31 /* TODO do some function and use inline if available */
32
37 #if ENABLE_EXTRA_CHECKS
38 void tds_dstr_init(DSTR * s);
39 int tds_dstr_isempty(DSTR * s);
40 char *tds_dstr_buf(DSTR * s);
41 size_t tds_dstr_len(DSTR * s);
42 #else
43
44 #define tds_dstr_init(s) \
45 do { DSTR *_tds_s = (s); _tds_s->dstr_size = 0; _tds_s->dstr_s = (char*) tds_str_empty; } while(0)
46
48 #define tds_dstr_isempty(s) \
49 ((s)->dstr_size == 0)
50 #define tds_dstr_buf(s) \
51 ((s)->dstr_s)
52 #define tds_dstr_len(s) \
53 ((s)->dstr_size)
54 #endif
55
56 #define tds_dstr_cstr(s) \
57 ((const char* ) tds_dstr_buf(s))
58
59 void tds_dstr_zero(DSTR * s);
60 void tds_dstr_free(DSTR * s);
61
62 DSTR* tds_dstr_dup(DSTR * s, const DSTR * src);
63 DSTR* tds_dstr_copy(DSTR * s, const char *src);
64 DSTR* tds_dstr_copyn(DSTR * s, const char *src, size_t length);
65 DSTR* tds_dstr_set(DSTR * s, char *src);
66
68 DSTR* tds_dstr_setlen(DSTR *s, size_t length);
70 DSTR* tds_dstr_alloc(DSTR *s, size_t length);
71
74 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
75 #pragma GCC visibility pop
76 #endif
77
78 #endif /* _tdsstring_h_ */