FreeTDS API
encodings.h
1 /*
2  * This file produced from ./encodings.pl on Tue Dec 10 09:01:13 2019
3  */
4 #ifdef TDS_ICONV_ENCODING_TABLES
5 
6 static const TDS_ENCODING canonic_charsets[] = {
7  { "ISO-8859-1", 1, 1, 0}, /* 0 */
8  { "UTF-8", 1, 4, 1}, /* 1 */
9  { "UCS-2LE", 2, 2, 2}, /* 2 */
10  { "UCS-2BE", 2, 2, 3}, /* 3 */
11  { "ARMSCII-8", 1, 1, 4}, /* 4 */
12  { "BIG-5", 1, 2, 5}, /* 5 */
13  { "BIG5-HKSCS", 1, 2, 6}, /* 6 */
14  { "C99", 1, 1, 7}, /* 7 */
15  { "CHINESE", 1, 1, 8}, /* 8 */
16  { "CN", 1, 1, 9}, /* 9 */
17  { "CN-GB", 1, 2, 10}, /* 10 */
18  { "CN-GB-ISOIR165", 1, 1, 11}, /* 11 */
19  { "CP1133", 1, 1, 12}, /* 12 */
20  { "CP1250", 1, 1, 13}, /* 13 */
21  { "CP1251", 1, 1, 14}, /* 14 */
22  { "CP1252", 1, 1, 15}, /* 15 */
23  { "CP1253", 1, 1, 16}, /* 16 */
24  { "CP1254", 1, 1, 17}, /* 17 */
25  { "CP1255", 1, 1, 18}, /* 18 */
26  { "CP1256", 1, 1, 19}, /* 19 */
27  { "CP1257", 1, 1, 20}, /* 20 */
28  { "CP1258", 1, 1, 21}, /* 21 */
29  { "CP1361", 1, 2, 22}, /* 22 */
30  { "CP437", 1, 1, 23}, /* 23 */
31  { "CP850", 1, 1, 24}, /* 24 */
32  { "CP862", 1, 1, 25}, /* 25 */
33  { "CP866", 1, 1, 26}, /* 26 */
34  { "CP874", 1, 1, 27}, /* 27 */
35  { "CP932", 1, 2, 28}, /* 28 */
36  { "CP936", 1, 2, 29}, /* 29 */
37  { "CP949", 1, 2, 30}, /* 30 */
38  { "CP950", 1, 2, 31}, /* 31 */
39  { "EUC-JP", 1, 3, 32}, /* 32 */
40  { "EUC-KR", 1, 2, 33}, /* 33 */
41  { "EUC-TW", 1, 4, 34}, /* 34 */
42  { "GB18030", 1, 4, 35}, /* 35 */
43  { "GEORGIAN-ACADEMY", 1, 1, 36}, /* 36 */
44  { "GEORGIAN-PS", 1, 1, 37}, /* 37 */
45  { "HZ", 1, 1, 38}, /* 38 */
46  { "ISO-2022-CN", 1, 4, 39}, /* 39 */
47  { "ISO-2022-CN-EXT", 1, 4, 40}, /* 40 */
48  { "ISO-2022-JP", 1, 1, 41}, /* 41 */
49  { "ISO-2022-JP-1", 1, 1, 42}, /* 42 */
50  { "ISO-2022-JP-2", 1, 1, 43}, /* 43 */
51  { "ISO-2022-KR", 1, 2, 44}, /* 44 */
52  { "ISO-8859-10", 1, 1, 45}, /* 45 */
53  { "ISO-8859-13", 1, 1, 46}, /* 46 */
54  { "ISO-8859-14", 1, 1, 47}, /* 47 */
55  { "ISO-8859-15", 1, 1, 48}, /* 48 */
56  { "ISO-8859-16", 1, 1, 49}, /* 49 */
57  { "ISO-8859-2", 1, 1, 50}, /* 50 */
58  { "ISO-8859-3", 1, 1, 51}, /* 51 */
59  { "ISO-8859-4", 1, 1, 52}, /* 52 */
60  { "ISO-8859-5", 1, 1, 53}, /* 53 */
61  { "ISO-8859-6", 1, 1, 54}, /* 54 */
62  { "ISO-8859-7", 1, 1, 55}, /* 55 */
63  { "ISO-8859-8", 1, 1, 56}, /* 56 */
64  { "ISO-8859-9", 1, 1, 57}, /* 57 */
65  { "ISO-IR-14", 1, 1, 58}, /* 58 */
66  { "ISO-IR-149", 1, 1, 59}, /* 59 */
67  { "ISO-IR-159", 1, 1, 60}, /* 60 */
68  { "ISO-IR-166", 1, 1, 61}, /* 61 */
69  { "ISO-IR-87", 1, 1, 62}, /* 62 */
70  { "JAVA", 1, 1, 63}, /* 63 */
71  { "JISX0201-1976", 1, 1, 64}, /* 64 */
72  { "KOI8-R", 1, 1, 65}, /* 65 */
73  { "KOI8-RU", 1, 1, 66}, /* 66 */
74  { "KOI8-T", 1, 1, 67}, /* 67 */
75  { "KOI8-U", 1, 1, 68}, /* 68 */
76  { "MAC", 1, 1, 69}, /* 69 */
77  { "MACARABIC", 1, 1, 70}, /* 70 */
78  { "MACCENTRALEUROPE", 1, 1, 71}, /* 71 */
79  { "MACCROATIAN", 1, 1, 72}, /* 72 */
80  { "MACCYRILLIC", 1, 1, 73}, /* 73 */
81  { "MACGREEK", 1, 1, 74}, /* 74 */
82  { "MACHEBREW", 1, 1, 75}, /* 75 */
83  { "MACICELAND", 1, 1, 76}, /* 76 */
84  { "MACROMANIA", 1, 1, 77}, /* 77 */
85  { "MACTHAI", 1, 1, 78}, /* 78 */
86  { "MACTURKISH", 1, 1, 79}, /* 79 */
87  { "MACUKRAINE", 1, 1, 80}, /* 80 */
88  { "MULELAO-1", 1, 1, 81}, /* 81 */
89  { "NEXTSTEP", 1, 1, 82}, /* 82 */
90  { "ROMAN8", 1, 1, 83}, /* 83 */
91  { "SJIS", 1, 2, 84}, /* 84 */
92  { "TCVN", 1, 1, 85}, /* 85 */
93  { "UCS-4BE", 4, 4, 86}, /* 86 */
94  { "UCS-4LE", 4, 4, 87}, /* 87 */
95  { "US-ASCII", 1, 1, 88}, /* 88 */
96  { "UTF-16BE", 2, 4, 89}, /* 89 */
97  { "UTF-16LE", 2, 4, 90}, /* 90 */
98  { "UTF-32BE", 4, 4, 91}, /* 91 */
99  { "UTF-32LE", 4, 4, 92}, /* 92 */
100  { "UTF-7", 1, 4, 93}, /* 93 */
101  { "VISCII", 1, 1, 94}, /* 94 */
102 };
103 
104 static const CHARACTER_SET_ALIAS iconv_aliases[] = {
105  { "646", 88 },
106  { "850", 24 },
107  { "862", 25 },
108  { "866", 26 },
109  { "ANSI_X3.4-1968", 88 },
110  { "ANSI_X3.4-1986", 88 },
111  { "ARABIC", 54 },
112  { "ARMSCII-8", 4 },
113  { "ASCII", 88 },
114  { "ASMO-708", 54 },
115  { "BIG-5", 5 },
116  { "BIG-FIVE", 5 },
117  { "BIG5", 5 },
118  { "BIG5-HKSCS", 6 },
119  { "BIG5HKSCS", 6 },
120  { "BIGFIVE", 5 },
121  { "C99", 7 },
122  { "CHINESE", 8 },
123  { "CN", 9 },
124  { "CN-BIG5", 5 },
125  { "CN-GB", 10 },
126  { "CN-GB-ISOIR165", 11 },
127  { "CP1133", 12 },
128  { "CP1250", 13 },
129  { "CP1251", 14 },
130  { "CP1252", 15 },
131  { "CP1253", 16 },
132  { "CP1254", 17 },
133  { "CP1255", 18 },
134  { "CP1256", 19 },
135  { "CP1257", 20 },
136  { "CP1258", 21 },
137  { "CP1361", 22 },
138  { "CP367", 88 },
139  { "CP437", 23 },
140  { "CP819", 0 },
141  { "CP850", 24 },
142  { "CP862", 25 },
143  { "CP866", 26 },
144  { "CP874", 27 },
145  { "CP932", 28 },
146  { "CP936", 29 },
147  { "CP949", 30 },
148  { "CP950", 31 },
149  { "CSASCII", 88 },
150  { "CSBIG5", 5 },
151  { "CSEUCKR", 33 },
152  { "CSEUCPKDFMTJAPANESE", 32 },
153  { "CSEUCTW", 34 },
154  { "CSGB2312", 10 },
155  { "CSHALFWIDTHKATAKANA", 64 },
156  { "CSHPROMAN8", 83 },
157  { "CSIBM866", 26 },
158  { "CSISO14JISC6220RO", 58 },
159  { "CSISO159JISX02121990", 60 },
160  { "CSISO2022CN", 39 },
161  { "CSISO2022JP", 41 },
162  { "CSISO2022JP2", 43 },
163  { "CSISO2022KR", 44 },
164  { "CSISO57GB1988", 9 },
165  { "CSISO58GB231280", 8 },
166  { "CSISO87JISX0208", 62 },
167  { "CSISOLATIN1", 0 },
168  { "CSISOLATIN2", 50 },
169  { "CSISOLATIN3", 51 },
170  { "CSISOLATIN4", 52 },
171  { "CSISOLATIN5", 57 },
172  { "CSISOLATIN6", 45 },
173  { "CSISOLATINARABIC", 54 },
174  { "CSISOLATINCYRILLIC", 53 },
175  { "CSISOLATINGREEK", 55 },
176  { "CSISOLATINHEBREW", 56 },
177  { "CSKOI8R", 65 },
178  { "CSKSC56011987", 59 },
179  { "CSMACINTOSH", 69 },
180  { "CSPC850MULTILINGUAL", 24 },
181  { "CSPC862LATINHEBREW", 25 },
182  { "CSSHIFTJIS", 84 },
183  { "CSUNICODE11", 3 },
184  { "CSUNICODE11UTF7", 93 },
185  { "CSVISCII", 94 },
186  { "CYRILLIC", 53 },
187  { "ECMA-114", 54 },
188  { "ECMA-118", 55 },
189  { "ELOT_928", 55 },
190  { "EUC-CN", 10 },
191  { "EUC-JP", 32 },
192  { "EUC-KR", 33 },
193  { "EUC-TW", 34 },
194  { "EUCCN", 10 },
195  { "EUCJP", 32 },
196  { "EUCKR", 33 },
197  { "EUCTW", 34 },
198  {"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 32 },
199  { "GB18030", 35 },
200  { "GB2312", 10 },
201  { "GBK", 29 },
202  { "GB_1988-80", 9 },
203  { "GB_2312-80", 8 },
204  { "GEORGIAN-ACADEMY", 36 },
205  { "GEORGIAN-PS", 37 },
206  { "GREEK", 55 },
207  { "GREEK8", 55 },
208  { "HEBREW", 56 },
209  { "HP-ROMAN8", 83 },
210  { "HZ", 38 },
211  { "HZ-GB-2312", 38 },
212  { "IBM-CP1133", 12 },
213  { "IBM367", 88 },
214  { "IBM437", 23 },
215  { "IBM819", 0 },
216  { "IBM850", 24 },
217  { "IBM862", 25 },
218  { "IBM866", 26 },
219  { "ISO-2022-CN", 39 },
220  { "ISO-2022-CN-EXT", 40 },
221  { "ISO-2022-JP", 41 },
222  { "ISO-2022-JP-1", 42 },
223  { "ISO-2022-JP-2", 43 },
224  { "ISO-2022-KR", 44 },
225  { "ISO-8859-1", 0 },
226  { "ISO-8859-10", 45 },
227  { "ISO-8859-13", 46 },
228  { "ISO-8859-14", 47 },
229  { "ISO-8859-15", 48 },
230  { "ISO-8859-16", 49 },
231  { "ISO-8859-2", 50 },
232  { "ISO-8859-3", 51 },
233  { "ISO-8859-4", 52 },
234  { "ISO-8859-5", 53 },
235  { "ISO-8859-6", 54 },
236  { "ISO-8859-7", 55 },
237  { "ISO-8859-8", 56 },
238  { "ISO-8859-9", 57 },
239  { "ISO-CELTIC", 47 },
240  { "ISO-IR-100", 0 },
241  { "ISO-IR-101", 50 },
242  { "ISO-IR-109", 51 },
243  { "ISO-IR-110", 52 },
244  { "ISO-IR-126", 55 },
245  { "ISO-IR-127", 54 },
246  { "ISO-IR-138", 56 },
247  { "ISO-IR-14", 58 },
248  { "ISO-IR-144", 53 },
249  { "ISO-IR-148", 57 },
250  { "ISO-IR-149", 59 },
251  { "ISO-IR-157", 45 },
252  { "ISO-IR-159", 60 },
253  { "ISO-IR-165", 11 },
254  { "ISO-IR-166", 61 },
255  { "ISO-IR-179", 46 },
256  { "ISO-IR-199", 47 },
257  { "ISO-IR-203", 48 },
258  { "ISO-IR-226", 49 },
259  { "ISO-IR-57", 9 },
260  { "ISO-IR-58", 8 },
261  { "ISO-IR-6", 88 },
262  { "ISO-IR-87", 62 },
263  { "ISO646-CN", 9 },
264  { "ISO646-JP", 58 },
265  { "ISO646-US", 88 },
266  { "ISO8859-1", 0 },
267  { "ISO8859-10", 45 },
268  { "ISO8859-15", 48 },
269  { "ISO8859-2", 50 },
270  { "ISO8859-4", 52 },
271  { "ISO8859-5", 53 },
272  { "ISO8859-6", 54 },
273  { "ISO8859-7", 55 },
274  { "ISO8859-8", 56 },
275  { "ISO8859-9", 57 },
276  { "ISO_646.IRV:1991", 88 },
277  { "ISO_8859-1", 0 },
278  { "ISO_8859-10", 45 },
279  { "ISO_8859-10:1992", 45 },
280  { "ISO_8859-13", 46 },
281  { "ISO_8859-14", 47 },
282  { "ISO_8859-14:1998", 47 },
283  { "ISO_8859-15", 48 },
284  { "ISO_8859-15:1998", 48 },
285  { "ISO_8859-16", 49 },
286  { "ISO_8859-16:2000", 49 },
287  { "ISO_8859-1:1987", 0 },
288  { "ISO_8859-2", 50 },
289  { "ISO_8859-2:1987", 50 },
290  { "ISO_8859-3", 51 },
291  { "ISO_8859-3:1988", 51 },
292  { "ISO_8859-4", 52 },
293  { "ISO_8859-4:1988", 52 },
294  { "ISO_8859-5", 53 },
295  { "ISO_8859-5:1988", 53 },
296  { "ISO_8859-6", 54 },
297  { "ISO_8859-6:1987", 54 },
298  { "ISO_8859-7", 55 },
299  { "ISO_8859-7:1987", 55 },
300  { "ISO_8859-8", 56 },
301  { "ISO_8859-8:1988", 56 },
302  { "ISO_8859-9", 57 },
303  { "ISO_8859-9:1989", 57 },
304  { "JAVA", 63 },
305  { "JIS0208", 62 },
306  { "JISX0201-1976", 64 },
307  { "JIS_C6220-1969-RO", 58 },
308  { "JIS_C6226-1983", 62 },
309  { "JIS_X0201", 64 },
310  { "JIS_X0208", 62 },
311  { "JIS_X0208-1983", 62 },
312  { "JIS_X0208-1990", 62 },
313  { "JIS_X0212", 60 },
314  { "JIS_X0212-1990", 60 },
315  { "JIS_X0212.1990-0", 60 },
316  { "JOHAB", 22 },
317  { "JP", 58 },
318  { "KOI8-R", 65 },
319  { "KOI8-RU", 66 },
320  { "KOI8-T", 67 },
321  { "KOI8-U", 68 },
322  { "KOREAN", 59 },
323  { "KSC_5601", 59 },
324  { "KS_C_5601-1987", 59 },
325  { "KS_C_5601-1989", 59 },
326  { "L1", 0 },
327  { "L2", 50 },
328  { "L3", 51 },
329  { "L4", 52 },
330  { "L5", 57 },
331  { "L6", 45 },
332  { "L7", 46 },
333  { "L8", 47 },
334  { "LATIN1", 0 },
335  { "LATIN2", 50 },
336  { "LATIN3", 51 },
337  { "LATIN4", 52 },
338  { "LATIN5", 57 },
339  { "LATIN6", 45 },
340  { "LATIN7", 46 },
341  { "LATIN8", 47 },
342  { "MAC", 69 },
343  { "MACARABIC", 70 },
344  { "MACCENTRALEUROPE", 71 },
345  { "MACCROATIAN", 72 },
346  { "MACCYRILLIC", 73 },
347  { "MACGREEK", 74 },
348  { "MACHEBREW", 75 },
349  { "MACICELAND", 76 },
350  { "MACINTOSH", 69 },
351  { "MACROMAN", 69 },
352  { "MACROMANIA", 77 },
353  { "MACTHAI", 78 },
354  { "MACTURKISH", 79 },
355  { "MACUKRAINE", 80 },
356  { "MS-ANSI", 15 },
357  { "MS-ARAB", 19 },
358  { "MS-CYRL", 14 },
359  { "MS-EE", 13 },
360  { "MS-GREEK", 16 },
361  { "MS-HEBR", 18 },
362  { "MS-TURK", 17 },
363  { "MS_KANJI", 84 },
364  { "MULELAO-1", 81 },
365  { "NEXTSTEP", 82 },
366  { "R8", 83 },
367  { "ROMAN8", 83 },
368  { "SHIFT-JIS", 84 },
369  { "SHIFT_JIS", 84 },
370  { "SJIS", 84 },
371  { "TCVN", 85 },
372  { "TCVN-5712", 85 },
373  { "TCVN5712-1", 85 },
374  { "TCVN5712-1:1993", 85 },
375  { "TIS-620", 61 },
376  { "TIS620", 61 },
377  { "TIS620-0", 61 },
378  { "TIS620.2529-1", 61 },
379  { "TIS620.2533-0", 61 },
380  { "TIS620.2533-1", 61 },
381  { "UCS-2BE", 3 },
382  { "UCS-2LE", 2 },
383  { "UCS-4BE", 86 },
384  { "UCS-4LE", 87 },
385  { "UHC", 30 },
386  { "UNICODE-1-1", 3 },
387  { "UNICODE-1-1-UTF-7", 93 },
388  { "UNICODEBIG", 3 },
389  { "UNICODELITTLE", 2 },
390  { "US", 88 },
391  { "US-ASCII", 88 },
392  { "UTF-16BE", 89 },
393  { "UTF-16LE", 90 },
394  { "UTF-32BE", 91 },
395  { "UTF-32LE", 92 },
396  { "UTF-7", 93 },
397  { "UTF-8", 1 },
398  { "UTF7", 93 },
399  { "UTF8", 1 },
400  { "VISCII", 94 },
401  { "VISCII1.1-1", 94 },
402  { "WINBALTRIM", 20 },
403  { "WINDOWS-1250", 13 },
404  { "WINDOWS-1251", 14 },
405  { "WINDOWS-1252", 15 },
406  { "WINDOWS-1253", 16 },
407  { "WINDOWS-1254", 17 },
408  { "WINDOWS-1255", 18 },
409  { "WINDOWS-1256", 19 },
410  { "WINDOWS-1257", 20 },
411  { "WINDOWS-1258", 21 },
412  { "WINDOWS-874", 27 },
413  { "X0201", 64 },
414  { "X0208", 62 },
415  { "X0212", 60 },
416  { "big5", 5 },
417  { "cp1250", 13 },
418  { "cp1251", 14 },
419  { "cp1252", 15 },
420  { "cp1253", 16 },
421  { "cp1254", 17 },
422  { "cp1255", 18 },
423  { "cp1256", 19 },
424  { "cp1257", 20 },
425  { "cp1258", 21 },
426  { "cp437", 23 },
427  { "cp850", 24 },
428  { "cp862", 25 },
429  { "cp866", 26 },
430  { "cp874", 27 },
431  { "eucJP", 32 },
432  { "eucKR", 33 },
433  { "eucTW", 34 },
434  { "hp15CN", 8 },
435  { "iso81", 0 },
436  { "iso815", 48 },
437  { "iso82", 50 },
438  { "iso83", 51 },
439  { "iso84", 52 },
440  { "iso85", 53 },
441  { "iso86", 54 },
442  { "iso87", 55 },
443  { "iso88", 56 },
444  { "iso88591", 0 },
445  { "iso885915", 48 },
446  { "iso88592", 50 },
447  { "iso88593", 51 },
448  { "iso88594", 52 },
449  { "iso88595", 53 },
450  { "iso88596", 54 },
451  { "iso88597", 55 },
452  { "iso88598", 56 },
453  { "iso88599", 57 },
454  { "iso89", 57 },
455  { "roma8", 83 },
456  { "roman8", 83 },
457  { "sjis", 84 },
458  { "thai8", 61 },
459  { "tis620", 61 },
460  { "utf8", 1 },
461  {NULL, 0}
462 };
463 
464 static const CHARACTER_SET_ALIAS sybase_aliases[] = {
465  { "ascii_8", 0 },
466  { "big5", 5 },
467  { "cp1250", 13 },
468  { "cp1251", 14 },
469  { "cp1252", 15 },
470  { "cp1253", 16 },
471  { "cp1254", 17 },
472  { "cp1255", 18 },
473  { "cp1256", 19 },
474  { "cp1257", 20 },
475  { "cp1258", 21 },
476  { "cp437", 23 },
477  { "cp850", 24 },
478  { "cp862", 25 },
479  { "cp866", 26 },
480  { "cp874", 27 },
481  { "cp932", 28 },
482  { "cp936", 29 },
483  { "cp949", 30 },
484  { "cp950", 31 },
485  { "greek8", 55 },
486  { "iso10", 45 },
487  { "iso13", 46 },
488  { "iso14", 47 },
489  { "iso15", 48 },
490  { "iso646", 88 },
491  { "iso88592", 50 },
492  { "iso88595", 53 },
493  { "iso88596", 54 },
494  { "iso88597", 55 },
495  { "iso88598", 56 },
496  { "iso88599", 57 },
497  { "iso_1", 0 },
498  { "koi8", 65 },
499  { "mac", 69 },
500  { "mac_cyr", 73 },
501  { "macgreek", 74 },
502  { "macthai", 78 },
503  { "macturk", 79 },
504  { "roman8", 83 },
505  { "sjis", 84 },
506  { "tis620", 61 },
507  { "utf8", 1 },
508  {NULL, 0}
509 };
510 #endif
511 
512 enum {
513  TDS_CHARSET_ISO_8859_1 = 0,
514  TDS_CHARSET_UTF_8 = 1,
515  TDS_CHARSET_UCS_2LE = 2,
516  TDS_CHARSET_UCS_2BE = 3,
517  TDS_CHARSET_ARMSCII_8 = 4,
518  TDS_CHARSET_BIG_5 = 5,
519  TDS_CHARSET_BIG5_HKSCS = 6,
520  TDS_CHARSET_C99 = 7,
521  TDS_CHARSET_CHINESE = 8,
522  TDS_CHARSET_CN = 9,
523  TDS_CHARSET_CN_GB = 10,
524  TDS_CHARSET_CN_GB_ISOIR165 = 11,
525  TDS_CHARSET_CP1133 = 12,
526  TDS_CHARSET_CP1250 = 13,
527  TDS_CHARSET_CP1251 = 14,
528  TDS_CHARSET_CP1252 = 15,
529  TDS_CHARSET_CP1253 = 16,
530  TDS_CHARSET_CP1254 = 17,
531  TDS_CHARSET_CP1255 = 18,
532  TDS_CHARSET_CP1256 = 19,
533  TDS_CHARSET_CP1257 = 20,
534  TDS_CHARSET_CP1258 = 21,
535  TDS_CHARSET_CP1361 = 22,
536  TDS_CHARSET_CP437 = 23,
537  TDS_CHARSET_CP850 = 24,
538  TDS_CHARSET_CP862 = 25,
539  TDS_CHARSET_CP866 = 26,
540  TDS_CHARSET_CP874 = 27,
541  TDS_CHARSET_CP932 = 28,
542  TDS_CHARSET_CP936 = 29,
543  TDS_CHARSET_CP949 = 30,
544  TDS_CHARSET_CP950 = 31,
545  TDS_CHARSET_EUC_JP = 32,
546  TDS_CHARSET_EUC_KR = 33,
547  TDS_CHARSET_EUC_TW = 34,
548  TDS_CHARSET_GB18030 = 35,
549  TDS_CHARSET_GEORGIAN_ACADEMY = 36,
550  TDS_CHARSET_GEORGIAN_PS = 37,
551  TDS_CHARSET_HZ = 38,
552  TDS_CHARSET_ISO_2022_CN = 39,
553  TDS_CHARSET_ISO_2022_CN_EXT = 40,
554  TDS_CHARSET_ISO_2022_JP = 41,
555  TDS_CHARSET_ISO_2022_JP_1 = 42,
556  TDS_CHARSET_ISO_2022_JP_2 = 43,
557  TDS_CHARSET_ISO_2022_KR = 44,
558  TDS_CHARSET_ISO_8859_10 = 45,
559  TDS_CHARSET_ISO_8859_13 = 46,
560  TDS_CHARSET_ISO_8859_14 = 47,
561  TDS_CHARSET_ISO_8859_15 = 48,
562  TDS_CHARSET_ISO_8859_16 = 49,
563  TDS_CHARSET_ISO_8859_2 = 50,
564  TDS_CHARSET_ISO_8859_3 = 51,
565  TDS_CHARSET_ISO_8859_4 = 52,
566  TDS_CHARSET_ISO_8859_5 = 53,
567  TDS_CHARSET_ISO_8859_6 = 54,
568  TDS_CHARSET_ISO_8859_7 = 55,
569  TDS_CHARSET_ISO_8859_8 = 56,
570  TDS_CHARSET_ISO_8859_9 = 57,
571  TDS_CHARSET_ISO_IR_14 = 58,
572  TDS_CHARSET_ISO_IR_149 = 59,
573  TDS_CHARSET_ISO_IR_159 = 60,
574  TDS_CHARSET_ISO_IR_166 = 61,
575  TDS_CHARSET_ISO_IR_87 = 62,
576  TDS_CHARSET_JAVA = 63,
577  TDS_CHARSET_JISX0201_1976 = 64,
578  TDS_CHARSET_KOI8_R = 65,
579  TDS_CHARSET_KOI8_RU = 66,
580  TDS_CHARSET_KOI8_T = 67,
581  TDS_CHARSET_KOI8_U = 68,
582  TDS_CHARSET_MAC = 69,
583  TDS_CHARSET_MACARABIC = 70,
584  TDS_CHARSET_MACCENTRALEUROPE = 71,
585  TDS_CHARSET_MACCROATIAN = 72,
586  TDS_CHARSET_MACCYRILLIC = 73,
587  TDS_CHARSET_MACGREEK = 74,
588  TDS_CHARSET_MACHEBREW = 75,
589  TDS_CHARSET_MACICELAND = 76,
590  TDS_CHARSET_MACROMANIA = 77,
591  TDS_CHARSET_MACTHAI = 78,
592  TDS_CHARSET_MACTURKISH = 79,
593  TDS_CHARSET_MACUKRAINE = 80,
594  TDS_CHARSET_MULELAO_1 = 81,
595  TDS_CHARSET_NEXTSTEP = 82,
596  TDS_CHARSET_ROMAN8 = 83,
597  TDS_CHARSET_SJIS = 84,
598  TDS_CHARSET_TCVN = 85,
599  TDS_CHARSET_UCS_4BE = 86,
600  TDS_CHARSET_UCS_4LE = 87,
601  TDS_CHARSET_US_ASCII = 88,
602  TDS_CHARSET_UTF_16BE = 89,
603  TDS_CHARSET_UTF_16LE = 90,
604  TDS_CHARSET_UTF_32BE = 91,
605  TDS_CHARSET_UTF_32LE = 92,
606  TDS_CHARSET_UTF_7 = 93,
607  TDS_CHARSET_VISCII = 94,
608  TDS_NUM_CHARSETS = 95
609 };
610 
tds_convert
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
tds_login::new_password
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:531
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:529
tds.h
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:1112
tds7_build_param_def_from_query
static char * tds7_build_param_def_from_query(TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params, size_t *out_len)
Return string with parameters definition, useful for TDS7+.
Definition: query.c:923
tds_login::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:541
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_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:1200
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:216
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:224
tdsdaterec
Used by tds_datecrack.
Definition: tds.h:157
tds_submit_rollback
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3719
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:107
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_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:869
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:3251
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:3063
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:3387
tds_socket::ret_status
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1203
tds_cursor::status
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:954
tds_login::server_charset
DSTR server_charset
charset of server e.g.
Definition: tds.h:518
tds_dynamic_stream
output stream to write data to a dynamic buffer
Definition: stream.h:99
tdsdaterec::decimicrosecond
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:168
tds_submit_execute
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1737
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:123
tds_multiple
Definition: tds.h:1019
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:1012
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:1042
tdsdaterec::timezone
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:169
tds_set_cur_dyn
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:189
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:696
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:88
tds_bcp_add_variable_columns
static int tds_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:565
tds_fix_column_size
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1564
tds_writetext_end
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1167
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_generic_put_info
TDSRET tds_generic_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
Put data information to wire.
Definition: data.c:873
tds_cursor::cursor_id
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:942
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:663
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 TDS 7....
Definition: tds_types.h:57
TDS_DONE_ERROR
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:252
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_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:3124
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:524
tdsmoney
Definition: proto.h:38
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:2224
tds_variant
Store variant informations.
Definition: tds.h:598
tds_file_stream::stream
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:970
tds_bcp_add_fixed_columns
static int tds_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:480
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_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:3151
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_bcp_init
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:82
tds_quote_string
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2310
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
tds_start_query
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:345
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:2021
tds_socket::cur_cursor
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1199
tds_dstr_set
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
tdsdump_off
void tdsdump_off(void)
Temporarily turn off logging.
Definition: log.c:76
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:556
tds7_get_instance_port
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
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:3349
tds_save_msg
Definition: login.c:169
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 ignored, int offset)
Send one row of data to server.
Definition: bulk.c:334
tds_login::bulk_copy
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:551
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:285
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:876
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_dynamic
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
TDS_DONE_COUNT
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:255
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_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:706
tds_datain_stream
input stream to read data from tds protocol
Definition: stream.h:63
tds_socket::out_buf_max
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1167
tds_dstr_alloc
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
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:1206
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:794
tds_ntlm_get_auth
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:691
tds_alloc_dynamic
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
tdsiconvinfo
Definition: iconv.h:91
TDS_DATETIMEALL::date
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:147
tds_dynamic::defer_close
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:998
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:2268
tds_get_uint
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:131
tds_send_emulated_rpc
static TDSRET tds_send_emulated_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
Send RPC as string query.
Definition: query.c:1965
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
Definition: convert.c:54
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
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:3320
conv_result
Definition: convert.h:33
tds_socket::in_len
unsigned in_len
input buffer length
Definition: tds.h:1170
tds_input_stream
define a stream of data used for input
Definition: stream.h:30
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
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:213
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:714
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_put_tinyint
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1422
tdsdaterec::dayofyear
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:163
pollfd
Definition: poll.h:52
tds_dstr_buf
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
tds_skip_quoted
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:535
tds_message
Definition: tds.h:876
TDS_IS_MSSQL
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1623
tdsunique
Definition: proto.h:61
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:227
tds_save_context
Definition: login.c:182
tds_willconvert
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3058
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_bcp_start_copy_in
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:881
tds_set_cur_cursor
static void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor)
Set current cursor.
Definition: query.c:2322
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:690
tds_errno_message_flags
Definition: iconv.h:78
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:737
tds_staticin_stream
input stream to read data from a static buffer
Definition: stream.h:81
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:551
tds_varmax_stream
Definition: data.c:489
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:311
tdsdaterec::second
TDS_INT second
0-59
Definition: tds.h:167
tds_file_stream::f
FILE * f
file to read from
Definition: bulk.c:972
tds_cursor::query
char * query
SQL query.
Definition: tds.h:948
tdsdaterec::day
TDS_INT day
day of month (1-31)
Definition: tds.h:162
tdsdaterec::weekday
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:164
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
tds_count_placeholders
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:591
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:513
tds_put_data
static TDSRET tds_put_data(TDSSOCKET *tds, TDSCOLUMN *curcol)
Write data to wire.
Definition: query.c:276
tds_pbcb
Holds clause buffer.
Definition: bulk.c:58
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:248
tdsdatetime
Definition: proto.h:49
tds_time::tm_min
int tm_min
minutes (0-59)
Definition: convert.c:60
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_login::tds_version
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:515
tds_dstr_dup
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
MD4Context
Definition: md4.h:8
tds_deferred_unprepare
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1864
tds7_build_param_def_from_params
static char * tds7_build_param_def_from_params(TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params, size_t *out_len)
Return string with parameters definition, useful for TDS7+.
Definition: query.c:988
tds_time::tm_sec
int tm_sec
seconds (0-59)
Definition: convert.c:61
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
stringz_to_numeric
static int stringz_to_numeric(const char *instr, CONV_RESULT *cr)
convert a zero terminated string to NUMERIC
Definition: convert.c:2262
TDS_DATETIMEALL::offset
TDS_SMALLINT offset
time offset
Definition: tds.h:148
tds_socket::in_flag
unsigned char in_flag
input buffer type
Definition: tds.h:1171
tds_numeric_to_string
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
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:2970
tds_result_info
Hold information for any results.
Definition: tds.h:769
TDSFILESTREAM
struct tds_file_stream TDSFILESTREAM
input stream to read a file
tdsdatetime4
Definition: proto.h:55
MD5Context
Definition: md5.h:8
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
tds_column_funcs
Definition: tds.h:638
tds_socket::cur_dyn
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1212
tds_cursor::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:940
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:2123
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:363
tds_pbcb::from_malloc
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
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:1102
tds_column_funcs::put_info
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:654
TDSBLOB
struct tds_blob TDSBLOB
Information about blobs (e.g.
tds_pbcb::pb
char * pb
buffer
Definition: bulk.c:61
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:394
tds_deferred_cursor_dealloc
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3129
tds_bcpinfo
Definition: tds.h:1563
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:3290
tds_submit_begin_tran
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3691
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
tdsmoney4
Definition: proto.h:44
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:249
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:705
tds_bcp_start
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:834
tds_encoding
Information relevant to libiconv.
Definition: tds.h:612
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:184
tds_put_params
static TDSRET tds_put_params(TDSSOCKET *tds, TDSPARAMINFO *info, int flags) TDS_WUR
Send parameters to server.
Definition: query.c:1802
tdsdump_on
void tdsdump_on(void)
Turn logging back on.
Definition: log.c:88
tds_pbcb::cb
unsigned int cb
buffer length
Definition: bulk.c:63
tds_read_packet
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:531
tds_swap_numeric
static void tds_swap_numeric(TDS_NUMERIC *num)
Converts numeric from Microsoft representation to internal one (Sybase).
Definition: data.c:1724
tds_cursor_dealloc
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3078
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:1326
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:698
tds_socket::rows_affected
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1209
tds_ntlm_auth
Definition: challenge.c:533
TDS_DATETIMEALL
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:144
tds_file_stream::left
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:980
tds_cursor::defer_close
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:947
tds_time::tm_hour
int tm_hour
hours (0-23)
Definition: convert.c:59
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
tds_authentication
Definition: tds.h:1047
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:3415
TDS_IDLE
@ TDS_IDLE
no data expected
Definition: tds.h:791
tdsdaterec::quarter
TDS_INT quarter
quarter (0-3)
Definition: tds.h:160
tds7_send_execute
static TDSRET tds7_send_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send dynamic request on TDS 7+ to be executed.
Definition: query.c:1700
tds_generic_put
TDSRET tds_generic_put(TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
Write data to wire.
Definition: data.c:945
TDS_SENDING
@ TDS_SENDING
client would send data
Definition: tds.h:793
tds_connection::pending_close
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1103
tds_socket::in_pos
unsigned in_pos
current position in in_buf
Definition: tds.h:1168
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
tds_submit_queryf
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:487
tdsdaterec::month
TDS_INT month
month number (0-11)
Definition: tds.h:161
tds_release_dynamic
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
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:1187
tds_socket::has_status
bool has_status
true is ret_status is valid
Definition: tds.h:1201
tds_cursor::cursor_name
char * cursor_name
name of the cursor
Definition: tds.h:941
tds_submit_unprepare
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1887
tds_answer
Definition: challenge.c:64
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:409
tds_time::tm_year
int tm_year
year (0=1900)
Definition: convert.c:56
TDSPBCB
struct tds_pbcb TDSPBCB
Holds clause buffer.
tds_time::tm_ns
int tm_ns
nanoseconds (0-999999999)
Definition: convert.c:62
tds_get_null_type
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2915
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:2708
tds_blob
Information about blobs (e.g.
Definition: tds.h:587
tds_get_usmallint
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
tds_put_data_info
static TDSRET tds_put_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
Put data information to wire.
Definition: query.c:1606
des_key
Definition: des.h:15
tds7_put_params_definition
static void tds7_put_params_definition(TDSSOCKET *tds, const char *param_definition, size_t param_length)
Send parameters definition to server.
Definition: query.c:1154
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:1210
tds_socket::current_results
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1194
tds_next_placeholder
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:555
tds_output_stream::buffer
char * buffer
write buffer.
Definition: stream.h:50
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:263
names_blob_prefix_t
Definition: challenge.c:71
tds_put_data_info_length
static int tds_put_data_info_length(TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
Calc information length in bytes (useful for calculating full packet length)
Definition: query.c:1676
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:161
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
tdsnumeric
Definition: proto.h:25
tds_socket::in_buf
unsigned char * in_buf
Input buffer.
Definition: tds.h:1154
tds_connection::product_version
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1072
tds_login::port
int port
port of database service
Definition: tds.h:514
tds_column_funcs::put_data
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:664
tds_dstr_zero
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
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:1472
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:637
tds_get_byte
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
tdsdaterec::hour
TDS_INT hour
0-23
Definition: tds.h:165
tds_needs_unprepare
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1842
tds_socket::out_flag
unsigned char out_flag
output buffer type
Definition: tds.h:1172
tds_headers
Definition: tds.h:568
tds_time::tm_mon
int tm_mon
month (0-11)
Definition: convert.c:57
tds_generic_get
TDSRET tds_generic_get(TDSSOCKET *tds, TDSCOLUMN *curcol)
Read a data from wire.
Definition: data.c:709
TDS_DATETIMEALL::time
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:146
tds_submit_commit
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3750
TDS_WRITING
@ TDS_WRITING
client is writing data
Definition: tds.h:792
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:307
tds_bcp_done
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:804
tds_login::password
DSTR password
password of account login
Definition: tds.h:530
tds_file_stream
input stream to read a file
Definition: bulk.c:968
TDS_SYB_VER
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1632
tds_socket
Information for a server connection.
Definition: tds.h:1141
tdsdaterec::year
TDS_INT year
year
Definition: tds.h:159
tds_column_funcs::put_info_len
tds_func_put_info_len * put_info_len
Returns metadata column information size.
Definition: tds.h:648
tds_dynamic::params
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1008
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:288
tds_dynamic::num_id
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:982
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:711
tds_dynamic_stream::size
size_t size
size of data inside buffer
Definition: stream.h:106
tds_skip_comment
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:510
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:93
tds_close_socket
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
tds_cursor::type
TDS_INT type
row fetched from this cursor
Definition: tds.h:957
tds_socket::login
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1214
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:179
tds_dynamic::id
char id[30]
id of dynamic.
Definition: tds.h:988
tds_prtype
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3052
tds_option_arg
Definition: tds.h:328
tds7_bcp_send_colmetadata
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:706
tds_dynamic::query
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1010
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_query_flush_packet
static TDSRET tds_query_flush_packet(TDSSOCKET *tds)
Flush query packet.
Definition: query.c:175
tds_dynamic::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:980
tds_cursor::cursor_rows
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:952
tds_file_stream::terminator
const char * terminator
terminator
Definition: bulk.c:975
tds_datain_stream::wire_size
size_t wire_size
bytes still to read
Definition: stream.h:65
tds_context
Definition: tds.h:1029
tds_quote_id
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2266
tds_save_env
Definition: login.c:175
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:3295
tdsdaterec::minute
TDS_INT minute
0-59
Definition: tds.h:166
tds_login
Definition: tds.h:511
_character_set_alias
Definition: iconv.h:72
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:256
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:1150
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:609
tds_file_stream::term_len
size_t term_len
terminator length in bytes
Definition: bulk.c:977
tds_cursor
Holds informations about a cursor.
Definition: tds.h:937
tds_connection
Definition: tds.h:1069
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_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:3179
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:207
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:529
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:703
tds_copy_stream
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163