FreeTDS API: src/tds/num_limits.h Source File

FreeTDS API

num_limits.h
1 #define LIMIT_INDEXES_ADJUST 4
2
3 static const signed char limit_indexes[79]= {
4 0, /* 0 */
5 -3, /* 1 */
6 -6, /* 2 */
7 -9, /* 3 */
8 -12, /* 4 */
9 -15, /* 5 */
10 -18, /* 6 */
11 -21, /* 7 */
12 -24, /* 8 */
13 -27, /* 9 */
14 -30, /* 10 */
15 -32, /* 11 */
16 -34, /* 12 */
17 -36, /* 13 */
18 -38, /* 14 */
19 -40, /* 15 */
20 -42, /* 16 */
21 -44, /* 17 */
22 -46, /* 18 */
23 -48, /* 19 */
24 -50, /* 20 */
25 -51, /* 21 */
26 -52, /* 22 */
27 -53, /* 23 */
28 -54, /* 24 */
29 -55, /* 25 */
30 -56, /* 26 */
31 -57, /* 27 */
32 -58, /* 28 */
33 -59, /* 29 */
34 -59, /* 30 */
35 -59, /* 31 */
36 -59, /* 32 */
37 -60, /* 33 */
38 -61, /* 34 */
39 -62, /* 35 */
40 -63, /* 36 */
41 -64, /* 37 */
42 -65, /* 38 */
43 -66, /* 39 */
44 -66, /* 40 */
45 -66, /* 41 */
46 -66, /* 42 */
47 -66, /* 43 */
48 -66, /* 44 */
49 -66, /* 45 */
50 -66, /* 46 */
51 -66, /* 47 */
52 -66, /* 48 */
53 -66, /* 49 */
54 -65, /* 50 */
55 -64, /* 51 */
56 -63, /* 52 */
57 -62, /* 53 */
58 -61, /* 54 */
59 -60, /* 55 */
60 -59, /* 56 */
61 -58, /* 57 */
62 -57, /* 58 */
63 -55, /* 59 */
64 -53, /* 60 */
65 -51, /* 61 */
66 -49, /* 62 */
67 -47, /* 63 */
68 -45, /* 64 */
69 -44, /* 65 */
70 -43, /* 66 */
71 -42, /* 67 */
72 -41, /* 68 */
73 -39, /* 69 */
74 -37, /* 70 */
75 -35, /* 71 */
76 -33, /* 72 */
77 -31, /* 73 */
78 -29, /* 74 */
79 -27, /* 75 */
80 -25, /* 76 */
81 -23, /* 77 */
82 -21, /* 78 */
83 };
84
85 static const TDS_WORD limits[]= {
86 0x00000001u, /* 0 */
87 0x0000000au, /* 1 */
88 0x00000064u, /* 2 */
89 0x000003e8u, /* 3 */
90 0x00002710u, /* 4 */
91 0x000186a0u, /* 5 */
92 0x000f4240u, /* 6 */
93 0x00989680u, /* 7 */
94 0x05f5e100u, /* 8 */
95 0x3b9aca00u, /* 9 */
96 0x00000002u, /* 10 */
97 0x540be400u, /* 11 */
98 0x00000017u, /* 12 */
99 0x4876e800u, /* 13 */
100 0x000000e8u, /* 14 */
101 0xd4a51000u, /* 15 */
102 0x00000918u, /* 16 */
103 0x4e72a000u, /* 17 */
104 0x00005af3u, /* 18 */
105 0x107a4000u, /* 19 */
106 0x00038d7eu, /* 20 */
107 0xa4c68000u, /* 21 */
108 0x002386f2u, /* 22 */
109 0x6fc10000u, /* 23 */
110 0x01634578u, /* 24 */
111 0x5d8a0000u, /* 25 */
112 0x0de0b6b3u, /* 26 */
113 0xa7640000u, /* 27 */
114 0x8ac72304u, /* 28 */
115 0x89e80000u, /* 29 */
116 0x00000005u, /* 30 */
117 0x6bc75e2du, /* 31 */
118 0x63100000u, /* 32 */
119 0x00000036u, /* 33 */
120 0x35c9adc5u, /* 34 */
121 0xdea00000u, /* 35 */
122 0x0000021eu, /* 36 */
123 0x19e0c9bau, /* 37 */
124 0xb2400000u, /* 38 */
125 0x0000152du, /* 39 */
126 0x02c7e14au, /* 40 */
127 0xf6800000u, /* 41 */
128 0x0000d3c2u, /* 42 */
129 0x1bceccedu, /* 43 */
130 0xa1000000u, /* 44 */
131 0x00084595u, /* 45 */
132 0x16140148u, /* 46 */
133 0x4a000000u, /* 47 */
134 0x0052b7d2u, /* 48 */
135 0xdcc80cd2u, /* 49 */
136 0xe4000000u, /* 50 */
137 0x033b2e3cu, /* 51 */
138 0x9fd0803cu, /* 52 */
139 0xe8000000u, /* 53 */
140 0x204fce5eu, /* 54 */
141 0x3e250261u, /* 55 */
142 0x10000000u, /* 56 */
143 0x00000001u, /* 57 */
144 0x431e0faeu, /* 58 */
145 0x6d7217cau, /* 59 */
146 0xa0000000u, /* 60 */
147 0x0000000cu, /* 61 */
148 0x9f2c9cd0u, /* 62 */
149 0x4674edeau, /* 63 */
150 0x40000000u, /* 64 */
151 0x0000007eu, /* 65 */
152 0x37be2022u, /* 66 */
153 0xc0914b26u, /* 67 */
154 0x80000000u, /* 68 */
155 0x000004eeu, /* 69 */
156 0x2d6d415bu, /* 70 */
157 0x85acef81u, /* 71 */
158 0x0000314du, /* 72 */
159 0xc6448d93u, /* 73 */
160 0x38c15b0au, /* 74 */
161 0x0001ed09u, /* 75 */
162 0xbead87c0u, /* 76 */
163 0x378d8e64u, /* 77 */
164 0x00134261u, /* 78 */
165 0x72c74d82u, /* 79 */
166 0x2b878fe8u, /* 80 */
167 0x00c097ceu, /* 81 */
168 0x7bc90715u, /* 82 */
169 0xb34b9f10u, /* 83 */
170 0x0785ee10u, /* 84 */
171 0xd5da46d9u, /* 85 */
172 0x00f436a0u, /* 86 */
173 0x4b3b4ca8u, /* 87 */
174 0x5a86c47au, /* 88 */
175 0x098a2240u, /* 89 */
176 0x00000002u, /* 90 */
177 0xf050fe93u, /* 91 */
178 0x8943acc4u, /* 92 */
179 0x5f655680u, /* 93 */
180 0x0000001du, /* 94 */
181 0x6329f1c3u, /* 95 */
182 0x5ca4bfabu, /* 96 */
183 0xb9f56100u, /* 97 */
184 0x00000125u, /* 98 */
185 0xdfa371a1u, /* 99 */
186 0x9e6f7cb5u, /* 100 */
187 0x4395ca00u, /* 101 */
188 0x00000b7au, /* 102 */
189 0xbc627050u, /* 103 */
190 0x305adf14u, /* 104 */
191 0xa3d9e400u, /* 105 */
192 0x000072cbu, /* 106 */
193 0x5bd86321u, /* 107 */
194 0xe38cb6ceu, /* 108 */
195 0x6682e800u, /* 109 */
196 0x00047bf1u, /* 110 */
197 0x9673df52u, /* 111 */
198 0xe37f2410u, /* 112 */
199 0x011d1000u, /* 113 */
200 0x002cd76fu, /* 114 */
201 0xe086b93cu, /* 115 */
202 0xe2f768a0u, /* 116 */
203 0x0b22a000u, /* 117 */
204 0x01c06a5eu, /* 118 */
205 0xc5433c60u, /* 119 */
206 0xddaa1640u, /* 120 */
207 0x6f5a4000u, /* 121 */
208 0x118427b3u, /* 122 */
209 0xb4a05bc8u, /* 123 */
210 0xa8a4de84u, /* 124 */
211 0x59868000u, /* 125 */
212 0xaf298d05u, /* 126 */
213 0x0e4395d6u, /* 127 */
214 0x9670b12bu, /* 128 */
215 0x7f410000u, /* 129 */
216 0x00000006u, /* 130 */
217 0xd79f8232u, /* 131 */
218 0x8ea3da61u, /* 132 */
219 0xe066ebb2u, /* 133 */
220 0xf88a0000u, /* 134 */
221 0x00000044u, /* 135 */
222 0x6c3b15f9u, /* 136 */
223 0x926687d2u, /* 137 */
224 0xc40534fdu, /* 138 */
225 0xb5640000u, /* 139 */
226 0x000002acu, /* 140 */
227 0x3a4edbbfu, /* 141 */
228 0xb8014e3bu, /* 142 */
229 0xa83411e9u, /* 143 */
230 0x15e80000u, /* 144 */
231 0x00001abau, /* 145 */
232 0x4714957du, /* 146 */
233 0x300d0e54u, /* 147 */
234 0x9208b31au, /* 148 */
235 0xdb100000u, /* 149 */
236 0x00010b46u, /* 150 */
237 0xc6cdd6e3u, /* 151 */
238 0xe0828f4du, /* 152 */
239 0xb456ff0cu, /* 153 */
240 0x8ea00000u, /* 154 */
241 0x000a70c3u, /* 155 */
242 0xc40a64e6u, /* 156 */
243 0xc5199909u, /* 157 */
244 0x0b65f67du, /* 158 */
245 0x92400000u, /* 159 */
246 0x006867a5u, /* 160 */
247 0xa867f103u, /* 161 */
248 0xb2fffa5au, /* 162 */
249 0x71fba0e7u, /* 163 */
250 0xb6800000u, /* 164 */
251 0x04140c78u, /* 165 */
252 0x940f6a24u, /* 166 */
253 0xfdffc788u, /* 167 */
254 0x73d4490du, /* 168 */
255 0x21000000u, /* 169 */
256 0x28c87cb5u, /* 170 */
257 0xc89a2571u, /* 171 */
258 0xebfdcb54u, /* 172 */
259 0x864ada83u, /* 173 */
260 0x4a000000u, /* 174 */
261 0x00000001u, /* 175 */
262 0x97d4df19u, /* 176 */
263 0xd6057673u, /* 177 */
264 0x37e9f14du, /* 178 */
265 0x3eec8920u, /* 179 */
266 0xe4000000u, /* 180 */
267 0x0000000fu, /* 181 */
268 0xee50b702u, /* 182 */
269 0x5c36a080u, /* 183 */
270 0x2f236d04u, /* 184 */
271 0x753d5b48u, /* 185 */
272 0xe8000000u, /* 186 */
273 0x0000009fu, /* 187 */
274 0x4f272617u, /* 188 */
275 0x9a224501u, /* 189 */
276 0xd762422cu, /* 190 */
277 0x946590d9u, /* 191 */
278 0x10000000u, /* 192 */
279 0x00000639u, /* 193 */
280 0x17877cecu, /* 194 */
281 0x0556b212u, /* 195 */
282 0x69d695bdu, /* 196 */
283 0xcbf7a87au, /* 197 */
284 0xa0000000u, /* 198 */
285 0x00003e3au, /* 199 */
286 0xeb4ae138u, /* 200 */
287 0x3562f4b8u, /* 201 */
288 0x2261d969u, /* 202 */
289 0xf7ac94cau, /* 203 */
290 0x40000000u, /* 204 */
291 0x00026e4du, /* 205 */
292 0x30eccc32u, /* 206 */
293 0x15dd8f31u, /* 207 */
294 0x57d27e23u, /* 208 */
295 0xacbdcfe6u, /* 209 */
296 0x80000000u, /* 210 */
297 0x00184f03u, /* 211 */
298 0xe93ff9f4u, /* 212 */
299 0xdaa797edu, /* 213 */
300 0x6e38ed64u, /* 214 */
301 0xbf6a1f01u, /* 215 */
302 0x00f31627u, /* 216 */
303 0x1c7fc390u, /* 217 */
304 0x8a8bef46u, /* 218 */
305 0x4e3945efu, /* 219 */
306 0x7a25360au, /* 220 */
307 0x097edd87u, /* 221 */
308 0x1cfda3a5u, /* 222 */
309 0x697758bfu, /* 223 */
310 0x0e3cbb5au, /* 224 */
311 0xc5741c64u, /* 225 */
312 0x5ef4a747u, /* 226 */
313 0x21e86476u, /* 227 */
314 0x1ea97776u, /* 228 */
315 0x8e5f518bu, /* 229 */
316 0xb6891be8u, /* 230 */
317 0x00000003u, /* 231 */
318 0xb58e88c7u, /* 232 */
319 0x5313ec9du, /* 233 */
320 0x329eaaa1u, /* 234 */
321 0x8fb92f75u, /* 235 */
322 0x215b1710u, /* 236 */
323 0x00000025u, /* 237 */
324 0x179157c9u, /* 238 */
325 0x3ec73e23u, /* 239 */
326 0xfa32aa4fu, /* 240 */
327 0x9d3bda93u, /* 241 */
328 0x4d8ee6a0u, /* 242 */
329 0x00000172u, /* 243 */
330 0xebad6ddcu, /* 244 */
331 0x73c86d67u, /* 245 */
332 0xc5faa71cu, /* 246 */
333 0x245689c1u, /* 247 */
334 0x07950240u, /* 248 */
335 0x00000e7du, /* 249 */
336 0x34c64a9cu, /* 250 */
337 0x85d4460du, /* 251 */
338 0xbbca8719u, /* 252 */
339 0x6b61618au, /* 253 */
340 0x4bd21680u, /* 254 */
341 0x000090e4u, /* 255 */
342 0x0fbeea1du, /* 256 */
343 0x3a4abc89u, /* 257 */
344 0x55e946feu, /* 258 */
345 0x31cdcf66u, /* 259 */
346 0xf634e100u, /* 260 */
347 0x0005a8e8u, /* 261 */
348 0x9d752524u, /* 262 */
349 0x46eb5d5du, /* 263 */
350 0x5b1cc5edu, /* 264 */
351 0xf20a1a05u, /* 265 */
352 0x9e10ca00u, /* 266 */
353 0x00389916u, /* 267 */
354 0x2693736au, /* 268 */
355 0xc531a5a5u, /* 269 */
356 0x8f1fbb4bu, /* 270 */
357 0x74650438u, /* 271 */
358 0x2ca7e400u, /* 272 */
359 0x0235faddu, /* 273 */
360 0x81c2822bu, /* 274 */
361 0xb3f07877u, /* 275 */
362 0x973d50f2u, /* 276 */
363 0x8bf22a31u, /* 277 */
364 0xbe8ee800u, /* 278 */
365 0x161bcca7u, /* 279 */
366 0x119915b5u, /* 280 */
367 0x0764b4abu, /* 281 */
368 0xe8652979u, /* 282 */
369 0x7775a5f1u, /* 283 */
370 0x71951000u, /* 284 */
371 0xdd15fe86u, /* 285 */
372 0xaffad912u, /* 286 */
373 0x49ef0eb7u, /* 287 */
374 0x13f39ebeu, /* 288 */
375 0xaa987b6eu, /* 289 */
376 0x6fd2a000u, /* 290 */
377 };
tds_quote_string
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2241
tds_column_funcs
Definition: tds.h:643
tds_get_locale
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:50
tds_dynamic
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
tdsdump_off
void tdsdump_off(TDSDUMP_OFF_ITEM *off_item)
Temporarily turn off logging for current thread.
Definition: log.c:81
tds_numeric_bytes_per_prec
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
tds_socket::bulk_query
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1244
tds_start_query
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:332
tds_column_funcs::put_data
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:662
tds_dstr_init
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
tds7_put_query_params
static void tds7_put_query_params(TDSSOCKET *tds, const char *query, size_t query_len)
Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)
Definition: query.c:1064
tds_submit_unprepare
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
tds_next_placeholder_ucs2le
static const char * tds_next_placeholder_ucs2le(const char *start, const char *end, int named)
Found the next placeholder (? or @param) in a string.
Definition: query.c:644
tdsdaterec::quarter
TDS_INT quarter
quarter (0-3)
Definition: tds.h:161
tds_socket::frozen_packets
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
tds_env::charset
char * charset
character set encoding
Definition: tds.h:968
tds_packet
Definition: tds.h:1057
tdsdaterec
Used by tds_datecrack.
Definition: tds.h:159
tds_dynamic::defer_close
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:997
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
tds_file_stream::left
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:1015
tds_cursor::cursor_rows
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:951
tds_deferred_cursor_dealloc
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
tds_set_param_type
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
tds_set_state
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
tds_time::tm_min
int tm_min
minutes (0-59)
Definition: convert.c:60
tds_put_data_info
static TDSRET tds_put_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
Put data information to wire.
Definition: query.c:1533
tds_cursor::status
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
tds_submit_query_params
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
tds_iconv_alloc
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:307
tds_output_stream::buffer
char * buffer
write buffer.
Definition: stream.h:50
tds_dstr_cstr
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
tds_file_stream::f
FILE * f
file to read from
Definition: bulk.c:1007
tds_time::tm_ns
int tm_ns
nanoseconds (0-999999999)
Definition: convert.c:62
tds_connection::cursors
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1107
tds_socket::has_status
bool has_status
true is ret_status is valid
Definition: tds.h:1245
tdsmoney
Definition: proto.h:39
TDS_DONE_COUNT
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
tds_login::password
DSTR password
password of account login
Definition: tds.h:535
tdsdaterec::decimicrosecond
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
tds_locale
Definition: tds.h:582
tds_prtype
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
tds_socket::in_pos
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
TDS_DATETIMEALL::date
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:148
tds_freeze_written
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
tds_iconv_from_collate
TDSICONV * tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5])
Get iconv information from a LCID (to support different column encoding under MSSQL2K)
Definition: iconv.c:1245
tds_strftime
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2992
tds_swap_numeric
static void tds_swap_numeric(TDS_NUMERIC *num)
Converts numeric from Microsoft representation to internal one (Sybase).
Definition: data.c:1674
tds.h
Main include file for libtds.
tds_pbcb::pb
char * pb
buffer
Definition: bulk.c:61
tds_socket_read
static int tds_socket_read(TDSCONNECTION *conn, TDSSOCKET *tds, unsigned char *buf, int buflen)
Read from an OS socket @TODO remove tds, save error somewhere, report error in another way.
Definition: net.c:727
tds_connection::env
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
tds_input_stream::read
int(* read)(struct tds_input_stream *stream, void *ptr, size_t len)
read some data Return 0 if end of stream Return <0 if error (actually not defined)
Definition: stream.h:35
tdsdaterec::day
TDS_INT day
day of month (1-31)
Definition: tds.h:163
tds_read_conf_section
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
tds7_write_param_def_from_query
static TDSRET tds7_write_param_def_from_query(TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:903
tds_get_socket_error
static int tds_get_socket_error(TDS_SYS_SOCKET sock)
Returns error stored in the socket.
Definition: net.c:217
tds_staticin_stream
input stream to read data from a static buffer
Definition: stream.h:81
tds_bcp_done
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:836
tds_socket::login
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
tds7_get_instance_ports
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1093
tds_generic_put
TDSRET tds_generic_put(TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
Write data to wire.
Definition: data.c:919
tds_encoding::canonic
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:624
tds_cursor
Holds informations about a cursor.
Definition: tds.h:937
tds_socket::out_buf
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
tds_file_stream::stream
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:1005
tds_socket_set_nonblocking
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
tds_init_login
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
tds_freeze_abort
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
tds_get_conversion_type
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
tds_set_cur_dyn
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
tds_connection::product_version
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
tds_socket_set_nosigpipe
int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on)
Set socket to not throw SIGPIPE.
Definition: net.c:72
tds_cursor::cursor_id
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
tds_alloc_dynamic
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
tds_convert
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1891
tds_freeze_close_len
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size)
Stop keeping data for this specific freeze.
Definition: packet.c:1031
tds_set_column_type
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
tds7_send_execute
static TDSRET tds7_send_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send dynamic request on TDS 7+ to be executed.
Definition: query.c:1593
TDSBLOB
struct tds_blob TDSBLOB
Information about blobs (e.g.
tdsdaterec::weekday
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
tds_socket::rows_affected
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
tds_socket::send_packet
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1231
tds_start_query_head
static TDSRET tds_start_query_head(TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head)
Start query packet of a given type.
Definition: query.c:291
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
tds_socket::in_buf
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
tds_save_env
Definition: login.c:180
tds_socket::cur_cursor
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
tds_close_socket
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
parse_numeric
static const char * parse_numeric(const char *buf, const char *pend, bool *p_negative, size_t *p_digits, size_t *p_decimals)
Parse a string for numbers.
Definition: convert.c:3435
tds_skip_quoted
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
conv_result
Definition: convert.h:34
pollfd
Definition: poll.h:52
tds_connection::dyns
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1112
tds_alloc_row
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
tds_goodread
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:916
tds_time::tm_mon
int tm_mon
month (0-11)
Definition: convert.c:57
tds_packet::data_len
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1071
MD5Context
Definition: md5.h:8
binary_to_result
static TDS_INT binary_to_result(int desttype, const void *data, size_t len, CONV_RESULT *cr)
Copy binary data to to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:196
tds_cursor_dealloc
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
tds_socket::in_row
bool in_row
true if we are getting rows
Definition: tds.h:1246
tds_iconv_get_info
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
tds_login::server_realm_name
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:527
poll.h
Provide poll call where missing.
tds_datain_stream_init
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
tds_count_placeholders_ucs2le
static int tds_count_placeholders_ucs2le(const char *query, const char *query_end)
Count the number of placeholders ('?') in a query.
Definition: query.c:692
tds_errno_message_flags
Definition: iconv.h:78
tds_get_dynid
static char * tds_get_dynid(TDSCONNECTION *conn, char *id)
Get an id for dynamic query based on TDS information.
Definition: mem.c:94
tds_ntlm_auth
Definition: challenge.c:564
tds_dynamic::emulated
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
tds_datain_stream
input stream to read data from tds protocol
Definition: stream.h:63
tds_generic_get
TDSRET tds_generic_get(TDSSOCKET *tds, TDSCOLUMN *curcol)
Read a data from wire.
Definition: data.c:713
tds_canonical_charset_name
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:982
tds_set_server
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
tds_process_simple_query
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
tds_answer_challenge
static TDSRET tds_answer_challenge(TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.
Definition: challenge.c:291
tds_send_emulated_execute
static TDSRET tds_send_emulated_execute(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
Emulate prepared execute traslating to a normal language.
Definition: query.c:3269
tds_column_funcs::put_info
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:652
tds_submit_queryf
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
tds_get_varint_size
int tds_get_varint_size(TDSCONNECTION *conn, int datatype)
tds_get_varint_size() returns the size of a variable length integer returned in a result string
Definition: tds_types.h:57
tds_dynamic::params
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
tds_bcp_start_insert_stmt
static TDSRET tds_bcp_start_insert_stmt(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Prepare the query to be sent to server to request BCP information.
Definition: bulk.c:266
tds_dstr_dup
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
tds_submit_begin_tran
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
tdsdatetime
Definition: proto.h:50
retry_addr
Definition: net.c:364
tds_output_stream::write
int(* write)(struct tds_output_stream *stream, size_t len)
write len bytes from buffer, return <0 if error or len
Definition: stream.h:41
tds_variant
Store variant informations.
Definition: tds.h:604
tds_cursor::type
TDS_INT type
row fetched from this cursor
Definition: tds.h:956
tdsdaterec::dayofyear
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
tds_lookup_dynamic
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2587
tds_get_null_type
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2926
tds_quote_id_rpc
size_t tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id for a RPC call.
Definition: query.c:2216
tds4_send_emulated_rpc
static TDSRET tds4_send_emulated_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
Send RPC as string query.
Definition: query.c:1873
tds_input_stream
define a stream of data used for input
Definition: stream.h:30
tds_save_msg
Definition: login.c:174
tds_dstr_setlen
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
tds_message
Definition: tds.h:876
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
TDS72_SMP_HEADER
TDS 7.2 SMP packet header.
Definition: proto.h:361
string_to_int8
static TDS_INT string_to_int8(const char *buf, const char *pend, TDS_INT8 *res)
convert a number in string to TDS_INT8
Definition: convert.c:3368
tds_dstr_set
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
TDSPBCB
struct tds_pbcb TDSPBCB
Holds clause buffer.
tds_send_cancel
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
MD4Context
Definition: md4.h:9
tds_cursor::query
char * query
SQL query.
Definition: tds.h:947
unix_to_nt_time
static void unix_to_nt_time(uint64_t *nt, struct timeval *tv)
put a 8 byte filetime from a time_t This takes GMT as input
Definition: challenge.c:586
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:689
tds7_bcp_send_colmetadata
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:736
tdsiconvinfo
Definition: iconv.h:92
tds_cursor::next
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:938
tds71_submit_prepexec
TDSRET tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server and execute it.
Definition: query.c:1401
tds_connection
Definition: tds.h:1091
tds_cursor::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:939
tds_datain_stream::wire_size
size_t wire_size
bytes still to read
Definition: stream.h:65
tds5_put_params
static TDSRET tds5_put_params(TDSSOCKET *tds, TDSPARAMINFO *info, int flags) TDS_WUR
Send parameters to server.
Definition: query.c:1693
tds_get_byte
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
tds_socket_write
static int tds_socket_write(TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen)
Write to an OS socket.
Definition: net.c:762
tds5_bcp_add_fixed_columns
static int tds5_bcp_add_fixed_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char *rowbuffer, int start)
Add fixed size columns to the row.
Definition: bulk.c:507
tds_submit_optioncmd
TDSRET tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
Send option commands to server.
Definition: query.c:3389
tds_dstr_get
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
tds_skip_comment
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
tds_writetext_continue
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1185
tds_connection::s
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1096
tds_time::tm_sec
int tm_sec
seconds (0-59)
Definition: convert.c:61
tds_put_param_as_string
static TDSRET tds_put_param_as_string(TDSSOCKET *tds, TDSPARAMINFO *params, int n)
Send a parameter to server.
Definition: query.c:3189
tds_next_placeholder
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:535
tds_socket::out_flag
unsigned char out_flag
output buffer type
Definition: tds.h:1196
tdsunique
Definition: proto.h:62
tds_goodwrite
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:987
tds_dynamic::next
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:978
tds_bcpcoldata
Definition: tds.h:628
tds_socket::in_cancel
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
tdsmoney4
Definition: proto.h:45
string_to_numeric
static int string_to_numeric(const char *instr, const char *pend, CONV_RESULT *cr)
convert a number in string to a TDSNUMERIC
Definition: convert.c:2279
tds_get_string
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
tds_datecrack
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3172
tds_cursor::defer_close
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:946
tds_dynamic::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:979
tds_file_stream::terminator
const char * terminator
terminator
Definition: bulk.c:1010
tds_submit_query
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
TDS_SENDING
@ TDS_SENDING
client would send data
Definition: tds.h:792
tds_blob
Information about blobs (e.g.
Definition: tds.h:593
tds_process_login_tokens
TDSRET tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:411
tds_login::bulk_copy
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:556
tds_put_data
static TDSRET tds_put_data(TDSSOCKET *tds, TDSCOLUMN *curcol)
Write data to wire.
Definition: query.c:279
tds_login::new_password
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:536
tds_dynamic_stream_init
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
tds_read_packet
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
tds_multiple
Definition: tds.h:1019
tds_writetext_start
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1147
tds_dynamic_stream
output stream to write data to a dynamic buffer
Definition: stream.h:99
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_login::tds_version
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:520
tds5_fix_dot_query
static char * tds5_fix_dot_query(const char *query, size_t *query_len, TDSPARAMINFO *params)
Substitute ?-style placeholders with named (@param) ones.
Definition: query.c:227
tds_result_info
Hold information for any results.
Definition: tds.h:769
tdsdaterec::hour
TDS_INT hour
0-23
Definition: tds.h:166
tds_alloc_param_result
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
tds_socket::cur_dyn
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1256
stringz_to_numeric
static int stringz_to_numeric(const char *instr, CONV_RESULT *cr)
convert a zero terminated string to NUMERIC
Definition: convert.c:2273
tds7_build_bulk_insert_stmt
static TDSRET tds7_build_bulk_insert_stmt(TDSSOCKET *tds, TDSPBCB *clause, TDSCOLUMN *bcpcol, int first)
Help to build query to be sent to server.
Definition: bulk.c:219
tds_bcp_row_free
static void tds_bcp_row_free(TDSRESULTINFO *result, unsigned char *row)
Free row data allocated in the result set.
Definition: bulk.c:904
tds_socket::current_results
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
tds_login::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
tds_cursor::cursor_name
char * cursor_name
name of the cursor
Definition: tds.h:940
tds_convert_string
const char * tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
Convert a string in an allocated buffer.
Definition: query.c:126
tdsdaterec::month
TDS_INT month
month number (0-11)
Definition: tds.h:162
TDS_WRITING
@ TDS_WRITING
client is writing data
Definition: tds.h:791
tdsdaterec::second
TDS_INT second
0-59
Definition: tds.h:168
tds_alloc_param_data
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
tds_cursor_check_allocated
static bool tds_cursor_check_allocated(TDSCONNECTION *conn, TDSCURSOR *cursor)
Check if a cursor is allocated into the server.
Definition: query.c:2991
tds_select
int tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
Select on a socket until it's available or the timeout expires.
Definition: net.c:612
TDS_PUT_N_AS_UCS2
#define TDS_PUT_N_AS_UCS2(tds, s)
Utility to convert a constant ascii string to ucs2 and send to server.
Definition: query.c:110
tds_pbcb::from_malloc
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
tds_get_size_by_type
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
tds_bcp_fread
TDSRET tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
Read a data file, passing the data through iconv().
Definition: bulk.c:1077
string_to_uint8
static TDS_INT string_to_uint8(const char *buf, const char *pend, TDS_UINT8 *res)
convert a number in string to TDS_UINT8
Definition: convert.c:3397
tds_submit_execute
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
tds_free_input_params
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
tds_socket::in_len
unsigned in_len
input buffer length
Definition: tds.h:1194
tds_socket::out_pos
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
tds7_write_param_def_from_params
static TDSRET tds7_write_param_def_from_params(TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:964
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
tds_ntlm_get_auth
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
tds_dstr_alloc
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
tds_submit_execdirect
TDSRET tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Submit a prepared query with parameters.
Definition: query.c:1256
tds_socket::ret_status
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
parse_int8
static TDS_INT parse_int8(const char *buf, const char *pend, TDS_UINT8 *res, bool *p_negative)
convert a number in string to TDS_INT8
Definition: convert.c:3338
tds_copy_stream
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
tds_put_tinyint
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1469
tdsdaterec::timezone
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:170
tds_convert_stream
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
tds5_bcp_add_variable_columns
static int tds5_bcp_add_variable_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR *rowbuffer, int start, int *pncols)
Add variable size columns to the row.
Definition: bulk.c:594
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
tds_dynamic::query
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1009
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
tds_column::column_varint_size
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
tds_pbcb::cb
unsigned int cb
buffer length
Definition: bulk.c:63
tds_needs_unprepare
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
tds_submit_rollback
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
tds_file_stream
input stream to read a file
Definition: bulk.c:1003
tds_staticin_stream_init
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
tdsdump_open
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
tds_fix_column_size
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1491
TDS_IS_MSSQL
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1722
string_to_result
static TDS_INT string_to_result(int desttype, const char *s, CONV_RESULT *cr)
Copy a terminated string to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:178
tds_get_char_data
TDSRET tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:195
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
tds_varmax_stream
Definition: data.c:490
tdsdaterec::year
TDS_INT year
year
Definition: tds.h:160
tds_bcp_init
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:84
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
tdsdump_off_item
Definition: tds.h:1501
tds_capabilities
Definition: tds.h:511
tds_put_string
int tds_put_string(TDSSOCKET *tds, const char *s, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
tdserror
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
tds_time::tm_year
int tm_year
year (0=1900)
Definition: convert.c:56
tds_quote_id
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
tds_login::port
int port
port of database service
Definition: tds.h:519
tds_realloc
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1876
tdsdump_dump_buf
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
tds_save_context
Definition: login.c:187
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
tds_dynamic::res_info
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:534
tds_iconv
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
TDS_DEAD
@ TDS_DEAD
no connection
Definition: tds.h:795
tds_file_stream_read
static int tds_file_stream_read(TDSINSTREAM *stream, void *ptr, size_t len)
Reads a chunk of data from file stream checking for terminator.
Definition: bulk.c:1047
tds_strndup
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
TDS_DATETIMEALL::offset
TDS_SMALLINT offset
time offset
Definition: tds.h:149
tds_release_dynamic
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
tds_env::database
char * database
database name
Definition: tds.h:970
tds_login::crlfile
DSTR crlfile
certificate revocation file
Definition: tds.h:531
TDS_DATETIMEALL::time
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:147
tds_error_message
Definition: util.c:237
tds_quote
static size_t tds_quote(TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len)
Quote a string properly.
Definition: query.c:2128
names_blob_prefix_t
Definition: challenge.c:72
tds_writetext_end
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
tds_dynamic::id
char id[30]
id of dynamic.
Definition: tds.h:987
tds_set_cur_cursor
static void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor)
Set current cursor.
Definition: query.c:2253
tds_authentication
Definition: tds.h:1047
TDS_DATETIMEALL
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
tds_bcp_start
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:866
tds_connection::pending_close
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1123
tds_get_n
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
tds_time::tm_mday
int tm_mday
month day (1-31)
Definition: convert.c:58
tds_skip_quoted_ucs2le
static const char * tds_skip_quoted_ucs2le(const char *s, const char *end)
Return pointer to end of a quoted string.
Definition: query.c:618
tds_pbcb
Holds clause buffer.
Definition: bulk.c:59
TDSFILESTREAM
struct tds_file_stream TDSFILESTREAM
input stream to read a file
TDS_IDLE
@ TDS_IDLE
no data expected
Definition: tds.h:790
tds_bcpinfo
Definition: tds.h:1661
tds_headers
Definition: tds.h:574
tds_dstr_len
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
tds_time
Definition: convert.c:55
tds_bcp_send_record
TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
Send one row of data to server.
Definition: bulk.c:468
tds_socket
Information for a server connection.
Definition: tds.h:1163
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
tds_count_placeholders
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
tds_socket::in_flag
unsigned char in_flag
input buffer type
Definition: tds.h:1195
tds_login::server_spn
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:528
des_key
Definition: des.h:16
tdsdump_on
void tdsdump_on(TDSDUMP_OFF_ITEM *off_item)
Turn logging back on for current thread.
Definition: log.c:101
tdsdatetime4
Definition: proto.h:56
tds_setup_socket
static TDSERRNO tds_setup_socket(TDS_SYS_SOCKET *p_sock, struct addrinfo *addr, unsigned int port, int *p_oserr)
Setup the socket and attempt a connection.
Definition: net.c:249
tdsdaterec::minute
TDS_INT minute
0-59
Definition: tds.h:167
tds7_get_instance_port
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
tds_query_flush_packet
static TDSRET tds_query_flush_packet(TDSSOCKET *tds)
Flush query packet.
Definition: query.c:178
TDS_SYB_VER
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1731
tds_submit_rpc
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
tds_socket::out_buf_max
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
tds_quoteout_stream
Definition: query.c:3098
TDS_DONE_ERROR
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
tds_get_column_declaration
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
tds_output_stream
define a stream of data used for output
Definition: stream.h:39
tds_freeze_close
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
tds_dynamic::num_id
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:981
tds_login::server_charset
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
tds_poll_wakeup
Definition: tds.h:1085
tds_option_arg
Definition: tds.h:330
tds_submit_commit
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
tds_freeze
void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
Stop writing to server and cache every packet not sending them to server.
Definition: packet.c:907
tds_answer
Definition: challenge.c:65
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
tds_env::block_size
int block_size
packet size (512-65535)
Definition: tds.h:965
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
tds_write_dump
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
store_monthname
static int store_monthname(const char *, struct tds_time *)
Test if a string is a month name and store correct month number.
Definition: convert.c:2719
tds_context
Definition: tds.h:1029
tds_get_uint
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
tds_get_usmallint
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
tds_deferred_unprepare
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
tds_alloc_compute_result
static TDSCOMPUTEINFO * tds_alloc_compute_result(TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
Allocate memory for storing compute info return NULL on out of memory.
Definition: mem.c:395
tds_dynamic_stream::size
size_t size
size of data inside buffer
Definition: stream.h:106
tdsnumeric
Definition: proto.h:26
tds_freeze
Definition: tds.h:1571
tds_file_stream::term_len
size_t term_len
terminator length in bytes
Definition: bulk.c:1012
tds_login
Definition: tds.h:517
tds_bcp_start_copy_in
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:916
tds_skip_comment_ucs2le
static const char * tds_skip_comment_ucs2le(const char *s, const char *end)
Skip a comment in a query.
Definition: query.c:589
tds_login::cafile
DSTR cafile
certificate authorities file
Definition: tds.h:530
tdsdump_close
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
string_to_int
static TDS_INT string_to_int(const char *buf, const char *pend, TDS_INT *res)
convert a number in string to TDS_INT
Definition: convert.c:3299
tds_submit_prepare
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
tds_generic_put_info
TDSRET tds_generic_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
Put data information to wire.
Definition: data.c:875
tds_detach_results
void tds_detach_results(TDSRESULTINFO *info)
Detach result info from it current socket.
Definition: mem.c:488
tds_numeric_to_string
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
tds_willconvert
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3106
tds_dstr_buf
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
tds_free_param_result
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
tds_quote_and_put
static void tds_quote_and_put(TDSSOCKET *tds, const char *s, const char *end)
Send a string to server while quoting it.
Definition: query.c:3079
tds_dstr_zero
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
tdsdump_log
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
tdsdump_col
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:455
tds_ascii_to_ucs2
static size_t tds_ascii_to_ucs2(char *buffer, const char *buf)
Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not co...
Definition: query.c:91
tds_time::tm_hour
int tm_hour
hours (0-23)
Definition: convert.c:59