FreeTDS API: include/cstypes.h Source File

FreeTDS API

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