FreeTDS API
alternative_character_sets.h
1 /*
2  * Copyright 2003 James K. Lowden <jklowden@schemamania.org>
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted, provided that redistributions of source
5  * code retain the above copyright notice.
6  */
7 
8  /*
9  * The purpose of this file is to help look up character set names.
10  *
11  * Any given encoding may be known by several (usually similar) aliases.
12  * For example, a system using ASCII encoding may report the character set as
13  * "ASCII", "US-ASCII", or "ISO646-US", among others. For details on what your system
14  * uses, you may wish to consult the nl_langinfo(3) manual page.
15  *
16  * GNU iconv converts a byte sequence from one encoding to another, but before it can do
17  * so, it must be told which is which. In the list below, the preferred GNU iconv(3) name
18  * is on the left and an alias is on the right. It is a simple exercise, left to the reader,
19  * to write a function that uses these data to look up the canonical name when provided
20  * an alias.
21  */
22 
23 #ifndef _ALTERNATIVE_CHARACTER_SETS_H_
24 #define _ALTERNATIVE_CHARACTER_SETS_H_
25 
26 /*
27  * $Id: alternative_character_sets.h,v 1.10 2005-02-26 13:08:32 freddy77 Exp $
28  */
29 
30 /*
31  * This list is sorted alphabetically, except that the most
32  * commonly used character sets are first.
33  */
34  /* ASCII */
35  { "US-ASCII", "US-ASCII" }
36  , { "US-ASCII", "ANSI_X3.4-1968" }
37  , { "US-ASCII", "ANSI_X3.4-1986" }
38  , { "US-ASCII", "ASCII" }
39  , { "US-ASCII", "CP367" }
40  , { "US-ASCII", "CSASCII" }
41  , { "US-ASCII", "IBM367" }
42  , { "US-ASCII", "ISO-IR-6" }
43  , { "US-ASCII", "ISO646-US" }
44  , { "US-ASCII", "ISO_646.IRV:1991" }
45  , { "US-ASCII", "US" }
46  , { "US-ASCII", "646" } /* NetBSD default */
47  /* ISO_8859-1 */
48  , { "ISO-8859-1", "ISO-8859-1" }
49  , { "ISO-8859-1", "CP819" }
50  , { "ISO-8859-1", "CSISOLATIN1" }
51  , { "ISO-8859-1", "IBM819" }
52  , { "ISO-8859-1", "ISO-IR-100" }
53  , { "ISO-8859-1", "ISO8859-1" }
54  , { "ISO-8859-1", "ISO_8859-1" }
55  , { "ISO-8859-1", "ISO_8859-1:1987" }
56  , { "ISO-8859-1", "L1" }
57  , { "ISO-8859-1", "LATIN1" }
58  , { "ISO-8859-1", "iso81" }
59  , { "ISO-8859-1", "iso88591" }
60  /* UCS-2 */
61  , { "UCS-2", "UCS-2" }
62  , { "UCS-2", "CSUNICODE" }
63  , { "UCS-2", "ISO-10646-UCS-2" }
64  , { "UCS-2", "UCS2" }
65  , { "UCS-2", "ucs2" }
66  , { "UCS-2-INTERNAL", "UCS-2-INTERNAL" }
67  , { "UCS-2-SWAPPED", "UCS-2-SWAPPED" }
68  , { "UCS-2BE", "UCS-2BE" }
69  , { "UCS-2BE", "CSUNICODE11" }
70  , { "UCS-2BE", "UNICODE-1-1" }
71  , { "UCS-2BE", "UNICODEBIG" }
72  , { "UCS-2LE", "UCS-2LE" }
73  , { "UCS-2LE", "UNICODELITTLE" }
74  /* UTF-8 */
75  , { "UTF-8", "UTF-8" }
76  , { "UTF-8", "UTF8" }
77  , { "UTF-8", "utf8" }
78 
79  /* Basically alphabetical from here */
80  , { "ARMSCII-8", "ARMSCII-8" }
81  , { "BIG-5", "BIG-5" }
82  , { "BIG-5", "BIG-FIVE" }
83  , { "BIG-5", "BIG5" }
84  , { "BIG-5", "BIGFIVE" }
85  , { "BIG-5", "CN-BIG5" }
86  , { "BIG-5", "CSBIG5" }
87  , { "BIG-5", "big5" }
88  , { "BIG5-HKSCS", "BIG5-HKSCS" }
89  , { "BIG5-HKSCS", "BIG5HKSCS" }
90  , { "C99", "C99" }
91  , { "CHINESE", "CHINESE" }
92  , { "CHINESE", "CSISO58GB231280" }
93  , { "CHINESE", "GB_2312-80" }
94  , { "CHINESE", "ISO-IR-58" }
95  , { "CHINESE", "hp15CN" }
96  , { "CN", "CN" }
97  , { "CN", "CSISO57GB1988" }
98  , { "CN", "GB_1988-80" }
99  , { "CN", "ISO-IR-57" }
100  , { "CN", "ISO646-CN" }
101  , { "CN-GB", "CN-GB" }
102  , { "CN-GB", "CSGB2312" }
103  , { "CN-GB", "EUC-CN" }
104  , { "CN-GB", "EUCCN" }
105  , { "CN-GB", "GB2312" }
106  , { "CN-GB-ISOIR165", "CN-GB-ISOIR165" }
107  , { "CN-GB-ISOIR165", "ISO-IR-165" }
108  , { "CP1133", "CP1133" }
109  , { "CP1133", "IBM-CP1133" }
110  , { "CP1250", "CP1250" }
111  , { "CP1250", "MS-EE" }
112  , { "CP1250", "WINDOWS-1250" }
113  , { "CP1250", "cp1250" }
114  , { "CP1251", "CP1251" }
115  , { "CP1251", "MS-CYRL" }
116  , { "CP1251", "WINDOWS-1251" }
117  , { "CP1251", "cp1251" }
118  , { "CP1252", "CP1252" }
119  , { "CP1252", "MS-ANSI" }
120  , { "CP1252", "WINDOWS-1252" }
121  , { "CP1252", "cp1252" }
122  , { "CP1253", "CP1253" }
123  , { "CP1253", "MS-GREEK" }
124  , { "CP1253", "WINDOWS-1253" }
125  , { "CP1253", "cp1253" }
126  , { "CP1254", "CP1254" }
127  , { "CP1254", "MS-TURK" }
128  , { "CP1254", "WINDOWS-1254" }
129  , { "CP1254", "cp1254" }
130  , { "CP1255", "CP1255" }
131  , { "CP1255", "MS-HEBR" }
132  , { "CP1255", "WINDOWS-1255" }
133  , { "CP1255", "cp1255" }
134  , { "CP1256", "CP1256" }
135  , { "CP1256", "MS-ARAB" }
136  , { "CP1256", "WINDOWS-1256" }
137  , { "CP1256", "cp1256" }
138  , { "CP1257", "CP1257" }
139  , { "CP1257", "WINBALTRIM" }
140  , { "CP1257", "WINDOWS-1257" }
141  , { "CP1257", "cp1257" }
142  , { "CP1258", "CP1258" }
143  , { "CP1258", "WINDOWS-1258" }
144  , { "CP1258", "cp1258" }
145  , { "CP1361", "CP1361" }
146  , { "CP1361", "JOHAB" }
147  , { "CP850", "CP850" }
148  , { "CP850", "850" }
149  , { "CP850", "CSPC850MULTILINGUAL" }
150  , { "CP850", "IBM850" }
151  , { "CP850", "cp850" }
152  , { "CP862", "CP862" }
153  , { "CP862", "862" }
154  , { "CP862", "CSPC862LATINHEBREW" }
155  , { "CP862", "IBM862" }
156  , { "CP862", "cp862" }
157  , { "CP866", "CP866" }
158  , { "CP866", "866" }
159  , { "CP866", "CSIBM866" }
160  , { "CP866", "IBM866" }
161  , { "CP866", "cp866" }
162  , { "CP874", "CP874" }
163  , { "CP874", "WINDOWS-874" }
164  , { "CP874", "cp874" }
165  , { "CP932", "CP932" }
166  , { "CP936", "CP936" }
167  , { "CP936", "GBK" }
168  , { "CP949", "CP949" }
169  , { "CP949", "UHC" }
170  , { "CP950", "CP950" }
171  , { "CP437", "CP437" }
172  , { "CP437", "cp437" }
173  , { "CP437", "IBM437" }
174  , { "EUC-JP", "EUC-JP" }
175  , { "EUC-JP", "CSEUCPKDFMTJAPANESE" }
176  , { "EUC-JP", "EUCJP" }
177  , { "EUC-JP", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE"}
178  , { "EUC-JP", "eucJP" }
179  , { "EUC-KR", "EUC-KR" }
180  , { "EUC-KR", "CSEUCKR" }
181  , { "EUC-KR", "EUCKR" }
182  , { "EUC-KR", "eucKR" }
183  , { "EUC-TW", "CSEUCTW" }
184  , { "EUC-TW", "EUC-TW" }
185  , { "EUC-TW", "EUCTW" }
186  , { "EUC-TW", "eucTW" }
187  , { "GB18030", "GB18030" }
188  , { "GEORGIAN-ACADEMY", "GEORGIAN-ACADEMY" }
189  , { "GEORGIAN-PS", "GEORGIAN-PS" }
190  , { "HZ", "HZ" }
191  , { "HZ", "HZ-GB-2312" }
192  , { "ISO-2022-CN", "ISO-2022-CN" }
193  , { "ISO-2022-CN", "CSISO2022CN" }
194  , { "ISO-2022-CN-EXT", "ISO-2022-CN-EXT" }
195  , { "ISO-2022-JP", "ISO-2022-JP" }
196  , { "ISO-2022-JP", "CSISO2022JP" }
197  , { "ISO-2022-JP-1", "ISO-2022-JP-1" }
198  , { "ISO-2022-JP-2", "ISO-2022-JP-2" }
199  , { "ISO-2022-JP-2", "CSISO2022JP2" }
200  , { "ISO-2022-KR", "ISO-2022-KR" }
201  , { "ISO-2022-KR", "CSISO2022KR" }
202  , { "ISO-8859-10", "ISO-8859-10" }
203  , { "ISO-8859-10", "CSISOLATIN6" }
204  , { "ISO-8859-10", "ISO-IR-157" }
205  , { "ISO-8859-10", "ISO8859-10" }
206  , { "ISO-8859-10", "ISO_8859-10" }
207  , { "ISO-8859-10", "ISO_8859-10:1992" }
208  , { "ISO-8859-10", "L6" }
209  , { "ISO-8859-10", "LATIN6" }
210  , { "ISO-8859-13", "ISO-8859-13" }
211  , { "ISO-8859-13", "ISO-IR-179" }
212  , { "ISO-8859-13", "ISO_8859-13" }
213  , { "ISO-8859-13", "L7" }
214  , { "ISO-8859-13", "LATIN7" }
215  , { "ISO-8859-14", "ISO-8859-14" }
216  , { "ISO-8859-14", "ISO-CELTIC" }
217  , { "ISO-8859-14", "ISO-IR-199" }
218  , { "ISO-8859-14", "ISO_8859-14" }
219  , { "ISO-8859-14", "ISO_8859-14:1998" }
220  , { "ISO-8859-14", "L8" }
221  , { "ISO-8859-14", "LATIN8" }
222  , { "ISO-8859-15", "ISO8859-15" }
223  , { "ISO-8859-15", "ISO-8859-15" }
224  , { "ISO-8859-15", "ISO-IR-203" }
225  , { "ISO-8859-15", "ISO_8859-15" }
226  , { "ISO-8859-15", "ISO_8859-15:1998" }
227  , { "ISO-8859-15", "iso815" }
228  , { "ISO-8859-15", "iso885915" }
229  , { "ISO-8859-16", "ISO-8859-16" }
230  , { "ISO-8859-16", "ISO-IR-226" }
231  , { "ISO-8859-16", "ISO_8859-16" }
232  , { "ISO-8859-16", "ISO_8859-16:2000" }
233  , { "ISO-8859-2", "ISO-8859-2" }
234  , { "ISO-8859-2", "CSISOLATIN2" }
235  , { "ISO-8859-2", "ISO8859-2" }
236  , { "ISO-8859-2", "ISO-IR-101" }
237  , { "ISO-8859-2", "ISO_8859-2" }
238  , { "ISO-8859-2", "ISO_8859-2:1987" }
239  , { "ISO-8859-2", "L2" }
240  , { "ISO-8859-2", "LATIN2" }
241  , { "ISO-8859-2", "iso82" }
242  , { "ISO-8859-2", "iso88592" }
243  , { "ISO-8859-3", "ISO-8859-3" }
244  , { "ISO-8859-3", "CSISOLATIN3" }
245  , { "ISO-8859-3", "ISO-IR-109" }
246  , { "ISO-8859-3", "ISO_8859-3" }
247  , { "ISO-8859-3", "ISO_8859-3:1988" }
248  , { "ISO-8859-3", "L3" }
249  , { "ISO-8859-3", "LATIN3" }
250  , { "ISO-8859-3", "iso83" }
251  , { "ISO-8859-3", "iso88593" }
252  , { "ISO-8859-4", "ISO8859-4" }
253  , { "ISO-8859-4", "CSISOLATIN4" }
254  , { "ISO-8859-4", "ISO-8859-4" }
255  , { "ISO-8859-4", "ISO-IR-110" }
256  , { "ISO-8859-4", "ISO_8859-4" }
257  , { "ISO-8859-4", "ISO_8859-4:1988" }
258  , { "ISO-8859-4", "L4" }
259  , { "ISO-8859-4", "LATIN4" }
260  , { "ISO-8859-4", "iso84" }
261  , { "ISO-8859-4", "iso88594" }
262  , { "ISO-8859-5", "ISO-8859-5" }
263  , { "ISO-8859-5", "CSISOLATINCYRILLIC" }
264  , { "ISO-8859-5", "CYRILLIC" }
265  , { "ISO-8859-5", "ISO8859-5" }
266  , { "ISO-8859-5", "ISO-IR-144" }
267  , { "ISO-8859-5", "ISO8859-5" }
268  , { "ISO-8859-5", "ISO_8859-5" }
269  , { "ISO-8859-5", "ISO_8859-5:1988" }
270  , { "ISO-8859-5", "iso85" }
271  , { "ISO-8859-5", "iso88595" }
272  , { "ISO-8859-6", "ISO-8859-6" }
273  , { "ISO-8859-6", "ARABIC" }
274  , { "ISO-8859-6", "ASMO-708" }
275  , { "ISO-8859-6", "CSISOLATINARABIC" }
276  , { "ISO-8859-6", "ECMA-114" }
277  , { "ISO-8859-6", "ISO-IR-127" }
278  , { "ISO-8859-6", "ISO8859-6" }
279  , { "ISO-8859-6", "ISO_8859-6" }
280  , { "ISO-8859-6", "ISO_8859-6:1987" }
281  , { "ISO-8859-6", "iso86" }
282  , { "ISO-8859-6", "iso88596" }
283  , { "ISO-8859-7", "ISO-8859-7" }
284  , { "ISO-8859-7", "CSISOLATINGREEK" }
285  , { "ISO-8859-7", "ECMA-118" }
286  , { "ISO-8859-7", "ELOT_928" }
287  , { "ISO-8859-7", "GREEK" }
288  , { "ISO-8859-7", "GREEK8" }
289  , { "ISO-8859-7", "ISO-IR-126" }
290  , { "ISO-8859-7", "ISO8859-7" }
291  , { "ISO-8859-7", "ISO_8859-7" }
292  , { "ISO-8859-7", "ISO_8859-7:1987" }
293  , { "ISO-8859-7", "iso87" }
294  , { "ISO-8859-7", "iso88597" }
295  , { "ISO-8859-8", "ISO-8859-8" }
296  , { "ISO-8859-8", "CSISOLATINHEBREW" }
297  , { "ISO-8859-8", "HEBREW" }
298  , { "ISO-8859-8", "ISO8859-8" }
299  , { "ISO-8859-8", "ISO-IR-138" }
300  , { "ISO-8859-8", "ISO_8859-8" }
301  , { "ISO-8859-8", "ISO_8859-8:1988" }
302  , { "ISO-8859-8", "iso88" }
303  , { "ISO-8859-8", "iso88598" }
304  , { "ISO-8859-9", "ISO-8859-9" }
305  , { "ISO-8859-9", "CSISOLATIN5" }
306  , { "ISO-8859-9", "ISO-IR-148" }
307  , { "ISO-8859-9", "ISO8859-9" }
308  , { "ISO-8859-9", "ISO_8859-9" }
309  , { "ISO-8859-9", "ISO_8859-9:1989" }
310  , { "ISO-8859-9", "L5" }
311  , { "ISO-8859-9", "LATIN5" }
312  , { "ISO-8859-9", "iso88599" }
313  , { "ISO-8859-9", "iso89" }
314  , { "ISO-IR-14", "ISO-IR-14" }
315  , { "ISO-IR-14", "CSISO14JISC6220RO" }
316  , { "ISO-IR-14", "ISO646-JP" }
317  , { "ISO-IR-14", "JIS_C6220-1969-RO" }
318  , { "ISO-IR-14", "JP" }
319  , { "ISO-IR-149", "ISO-IR-149" }
320  , { "ISO-IR-149", "CSKSC56011987" }
321  , { "ISO-IR-149", "KOREAN" }
322  , { "ISO-IR-149", "KSC_5601" }
323  , { "ISO-IR-149", "KS_C_5601-1987" }
324  , { "ISO-IR-149", "KS_C_5601-1989" }
325  , { "ISO-IR-159", "ISO-IR-159" }
326  , { "ISO-IR-159", "CSISO159JISX02121990" }
327  , { "ISO-IR-159", "JIS_X0212" }
328  , { "ISO-IR-159", "JIS_X0212-1990" }
329  , { "ISO-IR-159", "JIS_X0212.1990-0" }
330  , { "ISO-IR-159", "X0212" }
331  , { "ISO-IR-166", "ISO-IR-166" }
332  , { "ISO-IR-166", "TIS-620" }
333  , { "ISO-IR-166", "TIS620" }
334  , { "ISO-IR-166", "TIS620-0" }
335  , { "ISO-IR-166", "TIS620.2529-1" }
336  , { "ISO-IR-166", "TIS620.2533-0" }
337  , { "ISO-IR-166", "TIS620.2533-1" }
338  , { "ISO-IR-166", "thai8" }
339  , { "ISO-IR-166", "tis620" }
340  , { "ISO-IR-87", "ISO-IR-87" }
341  , { "ISO-IR-87", "CSISO87JISX0208" }
342  , { "ISO-IR-87", "JIS0208" }
343  , { "ISO-IR-87", "JIS_C6226-1983" }
344  , { "ISO-IR-87", "JIS_X0208" }
345  , { "ISO-IR-87", "JIS_X0208-1983" }
346  , { "ISO-IR-87", "JIS_X0208-1990" }
347  , { "ISO-IR-87", "X0208" }
348  , { "JAVA", "JAVA" }
349  , { "JISX0201-1976", "JISX0201-1976" }
350  , { "JISX0201-1976", "CSHALFWIDTHKATAKANA" }
351  , { "JISX0201-1976", "JIS_X0201" }
352  , { "JISX0201-1976", "X0201" }
353  , { "KOI8-R", "KOI8-R" }
354  , { "KOI8-R", "CSKOI8R" }
355  , { "KOI8-RU", "KOI8-RU" }
356  , { "KOI8-T", "KOI8-T" }
357  , { "KOI8-U", "KOI8-U" }
358  , { "MAC", "MAC" }
359  , { "MAC", "CSMACINTOSH" }
360  , { "MAC", "MACINTOSH" }
361  , { "MAC", "MACROMAN" }
362  , { "MACARABIC", "MACARABIC" }
363  , { "MACCENTRALEUROPE", "MACCENTRALEUROPE" }
364  , { "MACCROATIAN", "MACCROATIAN" }
365  , { "MACCYRILLIC", "MACCYRILLIC" }
366  , { "MACGREEK", "MACGREEK" }
367  , { "MACHEBREW", "MACHEBREW" }
368  , { "MACICELAND", "MACICELAND" }
369  , { "MACROMANIA", "MACROMANIA" }
370  , { "MACTHAI", "MACTHAI" }
371  , { "MACTURKISH", "MACTURKISH" }
372  , { "MACUKRAINE", "MACUKRAINE" }
373  , { "MULELAO-1", "MULELAO-1" }
374  , { "NEXTSTEP", "NEXTSTEP" }
375  , { "ROMAN8", "ROMAN8" }
376  , { "ROMAN8", "CSHPROMAN8" }
377  , { "ROMAN8", "HP-ROMAN8" }
378  , { "ROMAN8", "R8" }
379  , { "ROMAN8", "roma8" }
380  , { "ROMAN8", "roman8" }
381  , { "SJIS", "SJIS" }
382  , { "SJIS", "CSSHIFTJIS" }
383  , { "SJIS", "MS_KANJI" }
384  , { "SJIS", "SHIFT-JIS" }
385  , { "SJIS", "SHIFT_JIS" }
386  , { "SJIS", "sjis" }
387  , { "TCVN", "TCVN" }
388  , { "TCVN", "TCVN-5712" }
389  , { "TCVN", "TCVN5712-1" }
390  , { "TCVN", "TCVN5712-1:1993" }
391  , { "UCS-4", "UCS-4" }
392  , { "UCS-4", "CSUCS4" }
393  , { "UCS-4", "ISO-10646-UCS-4" }
394  , { "UCS-4", "UCS4" }
395  , { "UCS-4", "ucs4" }
396  , { "UCS-4-INTERNAL", "UCS-4-INTERNAL" }
397  , { "UCS-4-SWAPPED", "UCS-4-SWAPPED" }
398  , { "UCS-4BE", "UCS-4BE" }
399  , { "UCS-4LE", "UCS-4LE" }
400  , { "UTF-16", "UTF-16" }
401  , { "UTF-16", "UTF16" }
402  , { "UTF-16BE", "UTF-16BE" }
403  , { "UTF-16LE", "UTF-16LE" }
404  , { "UTF-32", "UTF-32" }
405  , { "UTF-32BE", "UTF-32BE" }
406  , { "UTF-32LE", "UTF-32LE" }
407  , { "UTF-7", "UTF-7" }
408  , { "UTF-7", "CSUNICODE11UTF7" }
409  , { "UTF-7", "UNICODE-1-1-UTF-7" }
410  , { "UTF-7", "UTF7" }
411  , { "VISCII", "VISCII" }
412  , { "VISCII", "CSVISCII" }
413  , { "VISCII", "VISCII1.1-1" }
414 
415  /*
416  * The following are noted in Tru64 manuals, but
417  * have no canonical names in FreeTDS
418  *
419  * TACTIS TACTIS codeset
420  * dechanyu DEC Hanyu codeset
421  * dechanzi DEC Hanzi codeset
422  * deckanji DEC Kanji codeset
423  * deckorean DEC Korean codeset
424  * sdeckanji Super DEC Kanji codeset
425  */
426 
427  /* no stopper row; add your own */
428 #endif
tds_needs_unprepare
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
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_login::bulk_copy
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:557
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_login::tds_version
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:521
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::new_password
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:537
tds_socket::has_status
bool has_status
true is ret_status is valid
Definition: tds.h:1246
tds_submit_unprepare
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
tds_headers
Definition: tds.h:575
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::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:547
tds_dynamic::emulated
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:994
tds_dstr_alloc
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
tdsdump_on
void tdsdump_on(void)
Turn logging back on.
Definition: log.c:88
tds_dynamic_stream::size
size_t size
size of data inside buffer
Definition: stream.h:106
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:519
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
TDS_IDLE
@ TDS_IDLE
no data expected
Definition: tds.h:791
tds_errno_message_flags
Definition: iconv.h:78
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_socket::in_buf
unsigned char * in_buf
Input buffer.
Definition: tds.h:1178
tds_socket::cur_cursor
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1244
tds_set_cur_dyn
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
tds_staticin_stream
input stream to read data from a static buffer
Definition: stream.h:81
tds_alloc_dynamic
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
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_freeze
Definition: tds.h:1566
tds_query_flush_packet
static TDSRET tds_query_flush_packet(TDSSOCKET *tds)
Flush query packet.
Definition: query.c:178
tds_submit_execute
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
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.h
TDS_SYB_VER
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1724
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
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_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
tds_option_arg
Definition: tds.h:331
tds_column_funcs::put_data
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:663
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
tds_submit_queryf
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
tds_read_packet
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
tds_blob
Information about blobs (e.g.
Definition: tds.h:594
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_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_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
tds_submit_begin_tran
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
tds_cursor::cursor_rows
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:952
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:704
tds_dstr_set
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
TDS72_SMP_HEADER
TDS 7.2 SMP packet header.
Definition: proto.h:361
tdsdump_open
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:112
tds_dynamic::defer_close
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:998
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
tds_result_info
Hold information for any results.
Definition: tds.h:770
tds_dstr_buf
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
tdsiconvinfo
Definition: iconv.h:92
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
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_cursor::type
TDS_INT type
row fetched from this cursor
Definition: tds.h:957
tds_connection::product_version
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1094
tds_cursor::cursor_id
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:942
tds_socket
Information for a server connection.
Definition: tds.h:1164
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
TDS_WRITING
@ TDS_WRITING
client is writing data
Definition: tds.h:792
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:530
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:877
tds_skip_quoted
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
tds_get_uint
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
tds_encoding::canonic
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:625
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_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:590
tds_column_funcs::put_info
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:653
tds_save_msg
Definition: login.c:170
tds_dstr_zero
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
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_freeze_abort
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
tds_output_stream
define a stream of data used for output
Definition: stream.h:39
tds_dynamic::query
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1010
pollfd
Definition: poll.h:52
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_context
Definition: tds.h:1030
tds_ntlm_get_auth
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
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:410
tds_skip_comment
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
tds_cursor::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:940
tds_count_placeholders
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
tds_login::port
int port
port of database service
Definition: tds.h:520
tds_socket::cur_dyn
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1257
tds_submit_rollback
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
tds_socket::current_results
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1239
tds_get_byte
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
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
tds_login::server_charset
DSTR server_charset
charset of server e.g.
Definition: tds.h:524
tds_cursor::cursor_name
char * cursor_name
name of the cursor
Definition: tds.h:941
tds_set_cur_cursor
static void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor)
Set current cursor.
Definition: query.c:2253
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
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_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
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_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_quote_string
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2241
tds_put_tinyint
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1468
tds_cursor::query
char * query
SQL query.
Definition: tds.h:948
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:756
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:354
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:1878
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:695
tds_put_data
static TDSRET tds_put_data(TDSSOCKET *tds, TDSCOLUMN *curcol)
Write data to wire.
Definition: query.c:279
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_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_quoteout_stream
Definition: query.c:3098
tds_close_socket
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
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:125
tdsdump_off
void tdsdump_off(void)
Temporarily turn off logging.
Definition: log.c:76
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_dynamic
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:978
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_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:1249
tds_cursor::defer_close
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:947
tds_dynamic::params
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1008
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:530
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
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_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_save_context
Definition: login.c:183
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:705
tds_dstr_len
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
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_DONE_ERROR
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:254
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_cursor
Holds informations about a cursor.
Definition: tds.h:938
tds_socket::out_flag
unsigned char out_flag
output buffer type
Definition: tds.h:1197
conv_result
Definition: convert.h:34
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_message
Definition: tds.h:877
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_login
Definition: tds.h:518
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_freeze_close
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
tds_socket::out_pos
unsigned out_pos
current position in out_buf
Definition: tds.h:1194
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_dynamic::num_id
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:982
tds_connection::pending_close
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1124
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_dynamic::id
char id[30]
id of dynamic.
Definition: tds.h:988
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:713
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:702
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
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_save_env
Definition: login.c:176
tds_dynamic::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:980
tds_socket::in_len
unsigned in_len
input buffer length
Definition: tds.h:1195
tds_freeze_written
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
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_socket::ret_status
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1251
tds_login::password
DSTR password
password of account login
Definition: tds.h:536
tds_submit_commit
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
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_DONE_COUNT
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:257
tds_next_placeholder
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:535
tds_release_dynamic
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
tds_deferred_unprepare
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:794
tds_socket::out_buf_max
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1192
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:690
tds_fix_column_size
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1491
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
tds_connection
Definition: tds.h:1092
TDS_IS_MSSQL
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1715
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:535
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
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:697
tds_socket::in_flag
unsigned char in_flag
input buffer type
Definition: tds.h:1196
tds_deferred_cursor_dealloc
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
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_dstr_setlen
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
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_cursor::status
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:954
tds_output_stream::buffer
char * buffer
write buffer.
Definition: stream.h:50
tds_multiple
Definition: tds.h:1020
tds_dynamic_stream
output stream to write data to a dynamic buffer
Definition: stream.h:99
tds_socket::in_pos
unsigned in_pos
current position in in_buf
Definition: tds.h:1193
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_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_cursor_dealloc
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122