FreeTDS API

cstypes.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 * Copyright (C) 1998-1999 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 _cstypes_h_
21 #define _cstypes_h_
22
23 #include "tds_sysdep_public.h"
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32
33 typedef int32_t CS_INT;
34 typedef uint32_t CS_UINT;
35 typedef int64_t CS_BIGINT;
36 typedef uint64_t CS_UBIGINT;
37 typedef int16_t CS_SMALLINT;
38 typedef uint16_t CS_USMALLINT;
39 typedef unsigned char CS_TINYINT;
40 typedef char CS_CHAR;
41 typedef unsigned char CS_BYTE;
42 typedef tds_sysdep_real32_type CS_REAL;
43 typedef tds_sysdep_real64_type CS_FLOAT;
44 typedef int32_t CS_BOOL;
45 typedef void CS_VOID;
46 typedef unsigned char CS_IMAGE;
47 typedef unsigned char CS_TEXT;
48 typedef unsigned char CS_LONGBINARY;
49 typedef unsigned char CS_LONGCHAR;
50 typedef long CS_LONG;
51 typedef unsigned char CS_BINARY;
52 typedef uint16_t CS_USHORT;
53 typedef unsigned char CS_BIT;
54
55 typedef CS_INT CS_RETCODE;
56
57 #define CS_MAX_NAME 132
58 #define CS_MAX_SCALE 77
59 #define CS_MAX_PREC 77 /* used by php */
60 #define CS_MAX_NUMLEN 33 /* used by roguewave */
61 #define CS_MAX_MSG 1024
62 #define CS_SQLSTATE_SIZE 8
63 #define CS_OBJ_NAME 400
64 #define CS_TP_SIZE 16 /* text pointer */
65 #define CS_TS_SIZE 8 /* length of timestamp */
66
67
68 typedef struct _cs_numeric
69 {
70 unsigned char precision;
71 unsigned char scale;
72 unsigned char array[CS_MAX_NUMLEN];
73 } CS_NUMERIC;
74
75 typedef CS_NUMERIC CS_DECIMAL;
76
77 typedef struct _cs_varbinary
78 {
79 CS_SMALLINT len;
80 CS_CHAR array[256];
81 } CS_VARBINARY;
82
83 typedef struct _cs_varchar
84 {
85 CS_SMALLINT len; /* length of the string */
86 CS_CHAR str[256]; /* string, no NULL terminator */
87 } CS_VARCHAR;
88
89 typedef struct _cs_config CS_CONFIG;
90 typedef struct _cs_context CS_CONTEXT;
91 typedef struct _cs_connection CS_CONNECTION;
92 typedef struct _cs_locale CS_LOCALE;
93 typedef struct _cs_command CS_COMMAND;
94 typedef struct _cs_blk_row CS_BLK_ROW;
95
96 typedef struct _cs_iodesc
97 {
98 CS_INT iotype;
99 CS_INT datatype;
100 CS_LOCALE *locale;
101 CS_INT usertype;
102 CS_INT total_txtlen;
103 CS_INT offset;
104 CS_BOOL log_on_update;
105 CS_CHAR name[CS_OBJ_NAME];
106 CS_INT namelen;
107 CS_BYTE timestamp[CS_TS_SIZE];
108 CS_INT timestamplen;
109 CS_BYTE textptr[CS_TP_SIZE];
110 CS_INT textptrlen;
111 } CS_IODESC;
112
113 typedef struct _cs_datafmt
114 {
115 CS_CHAR name[CS_MAX_NAME];
116 CS_INT namelen;
117 CS_INT datatype;
118 CS_INT format;
119 CS_INT maxlength;
120 CS_INT scale;
121 CS_INT precision;
122 CS_INT status;
123 CS_INT count;
124 CS_INT usertype;
125 CS_LOCALE *locale;
126 } CS_DATAFMT;
127
128 typedef struct _cs_money
129 {
130 CS_INT mnyhigh;
131 CS_UINT mnylow;
132 } CS_MONEY;
133
134 typedef struct _cs_money4
135 {
136 CS_INT mny4;
137 } CS_MONEY4;
138
139 typedef CS_INT CS_DATE;
140
141 typedef CS_INT CS_TIME;
142
143 typedef CS_UBIGINT CS_BIGDATETIME;
144 typedef CS_UBIGINT CS_BIGTIME;
145
146 typedef struct _cs_datetime
147 {
148 CS_INT dtdays;
149 CS_INT dttime;
150 } CS_DATETIME;
151
152 typedef struct _cs_datetime4
153 {
154 CS_USHORT days;
155 CS_USHORT minutes;
156 } CS_DATETIME4;
157
158 typedef struct _cs_daterec
159 {
160 CS_INT dateyear;
161 CS_INT datemonth;
162 CS_INT datedmonth;
163 CS_INT datedyear;
164 CS_INT datedweek;
165 CS_INT datehour;
166 CS_INT dateminute;
167 CS_INT datesecond;
168 CS_INT datemsecond;
169 CS_INT datetzone;
170 CS_INT datesecfrac;
171 CS_INT datesecprec;
172 } CS_DATEREC;
173
174 typedef CS_INT CS_MSGNUM;
175
176 typedef struct _cs_clientmsg
177 {
178 CS_INT severity;
179 CS_MSGNUM msgnumber;
180 CS_CHAR msgstring[CS_MAX_MSG];
181 CS_INT msgstringlen;
182 CS_INT osnumber;
183 CS_CHAR osstring[CS_MAX_MSG];
184 CS_INT osstringlen;
185 CS_INT status;
186 CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
187 CS_INT sqlstatelen;
188 } CS_CLIENTMSG;
189
190 typedef struct _cs_servermsg
191 {
192 CS_MSGNUM msgnumber;
193 CS_INT state;
194 CS_INT severity;
195 CS_CHAR text[CS_MAX_MSG];
196 CS_INT textlen;
197 CS_CHAR svrname[CS_MAX_NAME];
198 CS_INT svrnlen;
199 CS_CHAR proc[CS_MAX_NAME];
200 CS_INT proclen;
201 CS_INT line;
202 CS_INT status;
203 CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
204 CS_INT sqlstatelen;
205 } CS_SERVERMSG;
206
207 #ifdef __cplusplus
208 #if 0
209 {
210 #endif
211 }
212 #endif
213
214 #endif
_cs_command
Definition: ctlib.h:212
_cs_config
Definition: ctlib.h:45
_cs_context
Definition: ctlib.h:75
_cs_money
Definition: cstypes.h:129
_cs_servermsg
Definition: cstypes.h:191
_cs_numeric
Definition: cstypes.h:69
_cs_connection
Definition: ctlib.h:117
_cs_datetime
Definition: cstypes.h:147
_cs_varchar
Definition: cstypes.h:84
_cs_daterec
Definition: cstypes.h:159
_cs_money4
Definition: cstypes.h:135
_cs_datafmt
Definition: cstypes.h:114
_cs_varbinary
Definition: cstypes.h:78
_cs_datetime4
Definition: cstypes.h:153
_cs_locale
Definition: ctlib.h:248
_cs_iodesc
Definition: cstypes.h:97
_cs_clientmsg
Definition: cstypes.h:177