FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
odbc_export.h
1 #undef tdsdump_log
2 
3 #ifdef ENABLE_ODBC_WIDE
4 static SQLRETURN _SQLDriverConnect(SQLHDBC hdbc,
5  SQLHWND hwnd,
6  ODBC_CHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
7  ODBC_CHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
8  SQLUSMALLINT fDriverCompletion, int wide);
9 
10 SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnectW(
11  SQLHDBC hdbc,
12  SQLHWND hwnd,
13  SQLWCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
14  SQLWCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
15  SQLUSMALLINT fDriverCompletion)
16 {
17  if (TDS_UNLIKELY(tds_write_dump)) {
18  SQLWSTR_BUFS(1);
19  tdsdump_log(TDS_DBG_FUNC, "SQLDriverConnectW(%p, %p, %ls, %d, %p, %d, %p, %u)\n",
20  hdbc,
21  hwnd,
22  SQLWSTR(szConnStrIn), (int) cbConnStrIn,
23  szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut,
24  (unsigned int) fDriverCompletion);
25  SQLWSTR_FREE();
26  }
27  return _SQLDriverConnect(hdbc,
28  hwnd,
29  (ODBC_CHAR*) szConnStrIn, cbConnStrIn,
30  (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
31  fDriverCompletion, 1);
32 }
33 #endif
34 
35 SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnect(
36  SQLHDBC hdbc,
37  SQLHWND hwnd,
38  SQLCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
39  SQLCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
40  SQLUSMALLINT fDriverCompletion)
41 {
42  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDriverConnect(%p, %p, %s, %d, %p, %d, %p, %u)\n",
43  hdbc,
44  hwnd,
45  (const char*) szConnStrIn, (int) cbConnStrIn,
46  szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut,
47  (unsigned int) fDriverCompletion);
48 #ifdef ENABLE_ODBC_WIDE
49  return _SQLDriverConnect(hdbc,
50  hwnd,
51  (ODBC_CHAR*) szConnStrIn, cbConnStrIn,
52  (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
53  fDriverCompletion, 0);
54 #else
55  return _SQLDriverConnect(hdbc,
56  hwnd,
57  szConnStrIn, cbConnStrIn,
58  szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
59  fDriverCompletion);
60 #endif
61 }
62 
63 #ifdef ENABLE_ODBC_WIDE
64 static SQLRETURN _SQLColumnPrivileges(SQLHSTMT hstmt,
65  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
66  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
67  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
68  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
69 
70 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivilegesW(
71  SQLHSTMT hstmt,
72  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
73  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
74  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
75  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
76 {
77  if (TDS_UNLIKELY(tds_write_dump)) {
78  SQLWSTR_BUFS(4);
79  tdsdump_log(TDS_DBG_FUNC, "SQLColumnPrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
80  hstmt,
81  SQLWSTR(szCatalogName), (int) cbCatalogName,
82  SQLWSTR(szSchemaName), (int) cbSchemaName,
83  SQLWSTR(szTableName), (int) cbTableName,
84  SQLWSTR(szColumnName), (int) cbColumnName);
85  SQLWSTR_FREE();
86  }
87  return _SQLColumnPrivileges(hstmt,
88  (ODBC_CHAR*) szCatalogName, cbCatalogName,
89  (ODBC_CHAR*) szSchemaName, cbSchemaName,
90  (ODBC_CHAR*) szTableName, cbTableName,
91  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
92 }
93 #endif
94 
95 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivileges(
96  SQLHSTMT hstmt,
97  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
98  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
99  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
100  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
101 {
102  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumnPrivileges(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
103  hstmt,
104  (const char*) szCatalogName, (int) cbCatalogName,
105  (const char*) szSchemaName, (int) cbSchemaName,
106  (const char*) szTableName, (int) cbTableName,
107  (const char*) szColumnName, (int) cbColumnName);
108 #ifdef ENABLE_ODBC_WIDE
109  return _SQLColumnPrivileges(hstmt,
110  (ODBC_CHAR*) szCatalogName, cbCatalogName,
111  (ODBC_CHAR*) szSchemaName, cbSchemaName,
112  (ODBC_CHAR*) szTableName, cbTableName,
113  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
114 #else
115  return _SQLColumnPrivileges(hstmt,
116  szCatalogName, cbCatalogName,
117  szSchemaName, cbSchemaName,
118  szTableName, cbTableName,
119  szColumnName, cbColumnName);
120 #endif
121 }
122 
123 #ifdef ENABLE_ODBC_WIDE
124 static SQLRETURN _SQLForeignKeys(SQLHSTMT hstmt,
125  ODBC_CHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
126  ODBC_CHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
127  ODBC_CHAR * szPkTableName, SQLSMALLINT cbPkTableName,
128  ODBC_CHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
129  ODBC_CHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
130  ODBC_CHAR * szFkTableName, SQLSMALLINT cbFkTableName, int wide);
131 
132 SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeysW(
133  SQLHSTMT hstmt,
134  SQLWCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
135  SQLWCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
136  SQLWCHAR * szPkTableName, SQLSMALLINT cbPkTableName,
137  SQLWCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
138  SQLWCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
139  SQLWCHAR * szFkTableName, SQLSMALLINT cbFkTableName)
140 {
141  if (TDS_UNLIKELY(tds_write_dump)) {
142  SQLWSTR_BUFS(6);
143  tdsdump_log(TDS_DBG_FUNC, "SQLForeignKeysW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
144  hstmt,
145  SQLWSTR(szPkCatalogName), (int) cbPkCatalogName,
146  SQLWSTR(szPkSchemaName), (int) cbPkSchemaName,
147  SQLWSTR(szPkTableName), (int) cbPkTableName,
148  SQLWSTR(szFkCatalogName), (int) cbFkCatalogName,
149  SQLWSTR(szFkSchemaName), (int) cbFkSchemaName,
150  SQLWSTR(szFkTableName), (int) cbFkTableName);
151  SQLWSTR_FREE();
152  }
153  return _SQLForeignKeys(hstmt,
154  (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName,
155  (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName,
156  (ODBC_CHAR*) szPkTableName, cbPkTableName,
157  (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName,
158  (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName,
159  (ODBC_CHAR*) szFkTableName, cbFkTableName, 1);
160 }
161 #endif
162 
163 SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeys(
164  SQLHSTMT hstmt,
165  SQLCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
166  SQLCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
167  SQLCHAR * szPkTableName, SQLSMALLINT cbPkTableName,
168  SQLCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
169  SQLCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
170  SQLCHAR * szFkTableName, SQLSMALLINT cbFkTableName)
171 {
172  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLForeignKeys(%p, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d)\n",
173  hstmt,
174  (const char*) szPkCatalogName, (int) cbPkCatalogName,
175  (const char*) szPkSchemaName, (int) cbPkSchemaName,
176  (const char*) szPkTableName, (int) cbPkTableName,
177  (const char*) szFkCatalogName, (int) cbFkCatalogName,
178  (const char*) szFkSchemaName, (int) cbFkSchemaName,
179  (const char*) szFkTableName, (int) cbFkTableName);
180 #ifdef ENABLE_ODBC_WIDE
181  return _SQLForeignKeys(hstmt,
182  (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName,
183  (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName,
184  (ODBC_CHAR*) szPkTableName, cbPkTableName,
185  (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName,
186  (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName,
187  (ODBC_CHAR*) szFkTableName, cbFkTableName, 0);
188 #else
189  return _SQLForeignKeys(hstmt,
190  szPkCatalogName, cbPkCatalogName,
191  szPkSchemaName, cbPkSchemaName,
192  szPkTableName, cbPkTableName,
193  szFkCatalogName, cbFkCatalogName,
194  szFkSchemaName, cbFkSchemaName,
195  szFkTableName, cbFkTableName);
196 #endif
197 }
198 
199 #ifdef ENABLE_ODBC_WIDE
200 static SQLRETURN _SQLNativeSql(SQLHDBC hdbc,
201  ODBC_CHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
202  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr, int wide);
203 
204 SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSqlW(
205  SQLHDBC hdbc,
206  SQLWCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
207  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr)
208 {
209  if (TDS_UNLIKELY(tds_write_dump)) {
210  SQLWSTR_BUFS(1);
211  tdsdump_log(TDS_DBG_FUNC, "SQLNativeSqlW(%p, %ls, %d, %p, %d, %p)\n",
212  hdbc,
213  SQLWSTR(szSqlStrIn), (int) cbSqlStrIn,
214  szSqlStr, (int) cbSqlStrMax, pcbSqlStr);
215  SQLWSTR_FREE();
216  }
217  return _SQLNativeSql(hdbc,
218  (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn,
219  (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 1);
220 }
221 #endif
222 
223 SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSql(
224  SQLHDBC hdbc,
225  SQLCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
226  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr)
227 {
228  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLNativeSql(%p, %s, %d, %p, %d, %p)\n",
229  hdbc,
230  (const char*) szSqlStrIn, (int) cbSqlStrIn,
231  szSqlStr, (int) cbSqlStrMax, pcbSqlStr);
232 #ifdef ENABLE_ODBC_WIDE
233  return _SQLNativeSql(hdbc,
234  (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn,
235  (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 0);
236 #else
237  return _SQLNativeSql(hdbc,
238  szSqlStrIn, cbSqlStrIn,
239  szSqlStr, cbSqlStrMax, pcbSqlStr);
240 #endif
241 }
242 
243 #ifdef ENABLE_ODBC_WIDE
244 static SQLRETURN _SQLPrimaryKeys(SQLHSTMT hstmt,
245  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
246  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
247  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide);
248 
249 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeysW(
250  SQLHSTMT hstmt,
251  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
252  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
253  SQLWCHAR * szTableName, SQLSMALLINT cbTableName)
254 {
255  if (TDS_UNLIKELY(tds_write_dump)) {
256  SQLWSTR_BUFS(3);
257  tdsdump_log(TDS_DBG_FUNC, "SQLPrimaryKeysW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
258  hstmt,
259  SQLWSTR(szCatalogName), (int) cbCatalogName,
260  SQLWSTR(szSchemaName), (int) cbSchemaName,
261  SQLWSTR(szTableName), (int) cbTableName);
262  SQLWSTR_FREE();
263  }
264  return _SQLPrimaryKeys(hstmt,
265  (ODBC_CHAR*) szCatalogName, cbCatalogName,
266  (ODBC_CHAR*) szSchemaName, cbSchemaName,
267  (ODBC_CHAR*) szTableName, cbTableName, 1);
268 }
269 #endif
270 
271 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeys(
272  SQLHSTMT hstmt,
273  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
274  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
275  SQLCHAR * szTableName, SQLSMALLINT cbTableName)
276 {
277  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrimaryKeys(%p, %s, %d, %s, %d, %s, %d)\n",
278  hstmt,
279  (const char*) szCatalogName, (int) cbCatalogName,
280  (const char*) szSchemaName, (int) cbSchemaName,
281  (const char*) szTableName, (int) cbTableName);
282 #ifdef ENABLE_ODBC_WIDE
283  return _SQLPrimaryKeys(hstmt,
284  (ODBC_CHAR*) szCatalogName, cbCatalogName,
285  (ODBC_CHAR*) szSchemaName, cbSchemaName,
286  (ODBC_CHAR*) szTableName, cbTableName, 0);
287 #else
288  return _SQLPrimaryKeys(hstmt,
289  szCatalogName, cbCatalogName,
290  szSchemaName, cbSchemaName,
291  szTableName, cbTableName);
292 #endif
293 }
294 
295 #ifdef ENABLE_ODBC_WIDE
296 static SQLRETURN _SQLProcedureColumns(SQLHSTMT hstmt,
297  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
298  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
299  ODBC_CHAR * szProcName, SQLSMALLINT cbProcName,
300  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
301 
302 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumnsW(
303  SQLHSTMT hstmt,
304  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
305  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
306  SQLWCHAR * szProcName, SQLSMALLINT cbProcName,
307  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
308 {
309  if (TDS_UNLIKELY(tds_write_dump)) {
310  SQLWSTR_BUFS(4);
311  tdsdump_log(TDS_DBG_FUNC, "SQLProcedureColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
312  hstmt,
313  SQLWSTR(szCatalogName), (int) cbCatalogName,
314  SQLWSTR(szSchemaName), (int) cbSchemaName,
315  SQLWSTR(szProcName), (int) cbProcName,
316  SQLWSTR(szColumnName), (int) cbColumnName);
317  SQLWSTR_FREE();
318  }
319  return _SQLProcedureColumns(hstmt,
320  (ODBC_CHAR*) szCatalogName, cbCatalogName,
321  (ODBC_CHAR*) szSchemaName, cbSchemaName,
322  (ODBC_CHAR*) szProcName, cbProcName,
323  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
324 }
325 #endif
326 
327 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumns(
328  SQLHSTMT hstmt,
329  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
330  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
331  SQLCHAR * szProcName, SQLSMALLINT cbProcName,
332  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
333 {
334  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedureColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
335  hstmt,
336  (const char*) szCatalogName, (int) cbCatalogName,
337  (const char*) szSchemaName, (int) cbSchemaName,
338  (const char*) szProcName, (int) cbProcName,
339  (const char*) szColumnName, (int) cbColumnName);
340 #ifdef ENABLE_ODBC_WIDE
341  return _SQLProcedureColumns(hstmt,
342  (ODBC_CHAR*) szCatalogName, cbCatalogName,
343  (ODBC_CHAR*) szSchemaName, cbSchemaName,
344  (ODBC_CHAR*) szProcName, cbProcName,
345  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
346 #else
347  return _SQLProcedureColumns(hstmt,
348  szCatalogName, cbCatalogName,
349  szSchemaName, cbSchemaName,
350  szProcName, cbProcName,
351  szColumnName, cbColumnName);
352 #endif
353 }
354 
355 #ifdef ENABLE_ODBC_WIDE
356 static SQLRETURN _SQLProcedures(SQLHSTMT hstmt,
357  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
358  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
359  ODBC_CHAR * szProcName, SQLSMALLINT cbProcName, int wide);
360 
361 SQLRETURN ODBC_PUBLIC ODBC_API SQLProceduresW(
362  SQLHSTMT hstmt,
363  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
364  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
365  SQLWCHAR * szProcName, SQLSMALLINT cbProcName)
366 {
367  if (TDS_UNLIKELY(tds_write_dump)) {
368  SQLWSTR_BUFS(3);
369  tdsdump_log(TDS_DBG_FUNC, "SQLProceduresW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
370  hstmt,
371  SQLWSTR(szCatalogName), (int) cbCatalogName,
372  SQLWSTR(szSchemaName), (int) cbSchemaName,
373  SQLWSTR(szProcName), (int) cbProcName);
374  SQLWSTR_FREE();
375  }
376  return _SQLProcedures(hstmt,
377  (ODBC_CHAR*) szCatalogName, cbCatalogName,
378  (ODBC_CHAR*) szSchemaName, cbSchemaName,
379  (ODBC_CHAR*) szProcName, cbProcName, 1);
380 }
381 #endif
382 
383 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedures(
384  SQLHSTMT hstmt,
385  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
386  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
387  SQLCHAR * szProcName, SQLSMALLINT cbProcName)
388 {
389  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedures(%p, %s, %d, %s, %d, %s, %d)\n",
390  hstmt,
391  (const char*) szCatalogName, (int) cbCatalogName,
392  (const char*) szSchemaName, (int) cbSchemaName,
393  (const char*) szProcName, (int) cbProcName);
394 #ifdef ENABLE_ODBC_WIDE
395  return _SQLProcedures(hstmt,
396  (ODBC_CHAR*) szCatalogName, cbCatalogName,
397  (ODBC_CHAR*) szSchemaName, cbSchemaName,
398  (ODBC_CHAR*) szProcName, cbProcName, 0);
399 #else
400  return _SQLProcedures(hstmt,
401  szCatalogName, cbCatalogName,
402  szSchemaName, cbSchemaName,
403  szProcName, cbProcName);
404 #endif
405 }
406 
407 #ifdef ENABLE_ODBC_WIDE
408 static SQLRETURN _SQLTablePrivileges(SQLHSTMT hstmt,
409  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
410  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
411  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide);
412 
413 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivilegesW(
414  SQLHSTMT hstmt,
415  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
416  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
417  SQLWCHAR * szTableName, SQLSMALLINT cbTableName)
418 {
419  if (TDS_UNLIKELY(tds_write_dump)) {
420  SQLWSTR_BUFS(3);
421  tdsdump_log(TDS_DBG_FUNC, "SQLTablePrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
422  hstmt,
423  SQLWSTR(szCatalogName), (int) cbCatalogName,
424  SQLWSTR(szSchemaName), (int) cbSchemaName,
425  SQLWSTR(szTableName), (int) cbTableName);
426  SQLWSTR_FREE();
427  }
428  return _SQLTablePrivileges(hstmt,
429  (ODBC_CHAR*) szCatalogName, cbCatalogName,
430  (ODBC_CHAR*) szSchemaName, cbSchemaName,
431  (ODBC_CHAR*) szTableName, cbTableName, 1);
432 }
433 #endif
434 
435 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivileges(
436  SQLHSTMT hstmt,
437  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
438  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
439  SQLCHAR * szTableName, SQLSMALLINT cbTableName)
440 {
441  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTablePrivileges(%p, %s, %d, %s, %d, %s, %d)\n",
442  hstmt,
443  (const char*) szCatalogName, (int) cbCatalogName,
444  (const char*) szSchemaName, (int) cbSchemaName,
445  (const char*) szTableName, (int) cbTableName);
446 #ifdef ENABLE_ODBC_WIDE
447  return _SQLTablePrivileges(hstmt,
448  (ODBC_CHAR*) szCatalogName, cbCatalogName,
449  (ODBC_CHAR*) szSchemaName, cbSchemaName,
450  (ODBC_CHAR*) szTableName, cbTableName, 0);
451 #else
452  return _SQLTablePrivileges(hstmt,
453  szCatalogName, cbCatalogName,
454  szSchemaName, cbSchemaName,
455  szTableName, cbTableName);
456 #endif
457 }
458 
459 #ifdef ENABLE_ODBC_WIDE
460 static SQLRETURN _SQLConnect(SQLHDBC hdbc,
461  ODBC_CHAR * szDSN, SQLSMALLINT cbDSN,
462  ODBC_CHAR * szUID, SQLSMALLINT cbUID,
463  ODBC_CHAR * szAuthStr, SQLSMALLINT cbAuthStr, int wide);
464 
465 SQLRETURN ODBC_PUBLIC ODBC_API SQLConnectW(
466  SQLHDBC hdbc,
467  SQLWCHAR * szDSN, SQLSMALLINT cbDSN,
468  SQLWCHAR * szUID, SQLSMALLINT cbUID,
469  SQLWCHAR * szAuthStr, SQLSMALLINT cbAuthStr)
470 {
471  if (TDS_UNLIKELY(tds_write_dump)) {
472  SQLWSTR_BUFS(3);
473  tdsdump_log(TDS_DBG_FUNC, "SQLConnectW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
474  hdbc,
475  SQLWSTR(szDSN), (int) cbDSN,
476  SQLWSTR(szUID), (int) cbUID,
477  SQLWSTR(szAuthStr), (int) cbAuthStr);
478  SQLWSTR_FREE();
479  }
480  return _SQLConnect(hdbc,
481  (ODBC_CHAR*) szDSN, cbDSN,
482  (ODBC_CHAR*) szUID, cbUID,
483  (ODBC_CHAR*) szAuthStr, cbAuthStr, 1);
484 }
485 #endif
486 
487 SQLRETURN ODBC_PUBLIC ODBC_API SQLConnect(
488  SQLHDBC hdbc,
489  SQLCHAR * szDSN, SQLSMALLINT cbDSN,
490  SQLCHAR * szUID, SQLSMALLINT cbUID,
491  SQLCHAR * szAuthStr, SQLSMALLINT cbAuthStr)
492 {
493  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLConnect(%p, %s, %d, %s, %d, %s, %d)\n",
494  hdbc,
495  (const char*) szDSN, (int) cbDSN,
496  (const char*) szUID, (int) cbUID,
497  (const char*) szAuthStr, (int) cbAuthStr);
498 #ifdef ENABLE_ODBC_WIDE
499  return _SQLConnect(hdbc,
500  (ODBC_CHAR*) szDSN, cbDSN,
501  (ODBC_CHAR*) szUID, cbUID,
502  (ODBC_CHAR*) szAuthStr, cbAuthStr, 0);
503 #else
504  return _SQLConnect(hdbc,
505  szDSN, cbDSN,
506  szUID, cbUID,
507  szAuthStr, cbAuthStr);
508 #endif
509 }
510 
511 #ifdef ENABLE_ODBC_WIDE
512 static SQLRETURN _SQLDescribeCol(SQLHSTMT hstmt,
513  SQLUSMALLINT icol,
514  ODBC_CHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
515  SQLSMALLINT * pfSqlType,
516  SQLULEN * pcbColDef,
517  SQLSMALLINT * pibScale,
518  SQLSMALLINT * pfNullable, int wide);
519 
520 SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeColW(
521  SQLHSTMT hstmt,
522  SQLUSMALLINT icol,
523  SQLWCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
524  SQLSMALLINT * pfSqlType,
525  SQLULEN * pcbColDef,
526  SQLSMALLINT * pibScale,
527  SQLSMALLINT * pfNullable)
528 {
529  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeColW(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n",
530  hstmt,
531  (unsigned int) icol,
532  szColName, (int) cbColNameMax, pcbColName,
533  pfSqlType,
534  pcbColDef,
535  pibScale,
536  pfNullable);
537  return _SQLDescribeCol(hstmt,
538  icol,
539  (ODBC_CHAR*) szColName, cbColNameMax, pcbColName,
540  pfSqlType,
541  pcbColDef,
542  pibScale,
543  pfNullable, 1);
544 }
545 #endif
546 
547 SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeCol(
548  SQLHSTMT hstmt,
549  SQLUSMALLINT icol,
550  SQLCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
551  SQLSMALLINT * pfSqlType,
552  SQLULEN * pcbColDef,
553  SQLSMALLINT * pibScale,
554  SQLSMALLINT * pfNullable)
555 {
556  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeCol(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n",
557  hstmt,
558  (unsigned int) icol,
559  szColName, (int) cbColNameMax, pcbColName,
560  pfSqlType,
561  pcbColDef,
562  pibScale,
563  pfNullable);
564 #ifdef ENABLE_ODBC_WIDE
565  return _SQLDescribeCol(hstmt,
566  icol,
567  (ODBC_CHAR*) szColName, cbColNameMax, pcbColName,
568  pfSqlType,
569  pcbColDef,
570  pibScale,
571  pfNullable, 0);
572 #else
573  return _SQLDescribeCol(hstmt,
574  icol,
575  szColName, cbColNameMax, pcbColName,
576  pfSqlType,
577  pcbColDef,
578  pibScale,
579  pfNullable);
580 #endif
581 }
582 
583 #ifdef ENABLE_ODBC_WIDE
584 static SQLRETURN _SQLGetDescRec(SQLHDESC hdesc,
585  SQLSMALLINT RecordNumber,
586  ODBC_CHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
587  SQLSMALLINT * Type,
588  SQLSMALLINT * SubType,
589  SQLLEN * Length,
590  SQLSMALLINT * Precision,
591  SQLSMALLINT * Scale,
592  SQLSMALLINT * Nullable, int wide);
593 
594 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRecW(
595  SQLHDESC hdesc,
596  SQLSMALLINT RecordNumber,
597  SQLWCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
598  SQLSMALLINT * Type,
599  SQLSMALLINT * SubType,
600  SQLLEN * Length,
601  SQLSMALLINT * Precision,
602  SQLSMALLINT * Scale,
603  SQLSMALLINT * Nullable)
604 {
605  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRecW(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n",
606  hdesc,
607  (int) RecordNumber,
608  szName, (int) cbNameMax, pcbName,
609  Type,
610  SubType,
611  Length,
612  Precision,
613  Scale,
614  Nullable);
615  return _SQLGetDescRec(hdesc,
616  RecordNumber,
617  (ODBC_CHAR*) szName, cbNameMax, pcbName,
618  Type,
619  SubType,
620  Length,
621  Precision,
622  Scale,
623  Nullable, 1);
624 }
625 #endif
626 
627 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRec(
628  SQLHDESC hdesc,
629  SQLSMALLINT RecordNumber,
630  SQLCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
631  SQLSMALLINT * Type,
632  SQLSMALLINT * SubType,
633  SQLLEN * Length,
634  SQLSMALLINT * Precision,
635  SQLSMALLINT * Scale,
636  SQLSMALLINT * Nullable)
637 {
638  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRec(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n",
639  hdesc,
640  (int) RecordNumber,
641  szName, (int) cbNameMax, pcbName,
642  Type,
643  SubType,
644  Length,
645  Precision,
646  Scale,
647  Nullable);
648 #ifdef ENABLE_ODBC_WIDE
649  return _SQLGetDescRec(hdesc,
650  RecordNumber,
651  (ODBC_CHAR*) szName, cbNameMax, pcbName,
652  Type,
653  SubType,
654  Length,
655  Precision,
656  Scale,
657  Nullable, 0);
658 #else
659  return _SQLGetDescRec(hdesc,
660  RecordNumber,
661  szName, cbNameMax, pcbName,
662  Type,
663  SubType,
664  Length,
665  Precision,
666  Scale,
667  Nullable);
668 #endif
669 }
670 
671 #ifdef ENABLE_ODBC_WIDE
672 static SQLRETURN _SQLGetDescField(SQLHDESC hdesc,
673  SQLSMALLINT icol,
674  SQLSMALLINT fDescType,
675  SQLPOINTER Value,
676  SQLINTEGER BufferLength,
677  SQLINTEGER * StringLength, int wide);
678 
679 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescFieldW(
680  SQLHDESC hdesc,
681  SQLSMALLINT icol,
682  SQLSMALLINT fDescType,
683  SQLPOINTER Value,
684  SQLINTEGER BufferLength,
685  SQLINTEGER * StringLength)
686 {
687  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescFieldW(%p, %d, %d, %p, %d, %p)\n",
688  hdesc,
689  (int) icol,
690  (int) fDescType,
691  Value,
692  (int) BufferLength,
693  StringLength);
694  return _SQLGetDescField(hdesc,
695  icol,
696  fDescType,
697  Value,
698  BufferLength,
699  StringLength, 1);
700 }
701 #endif
702 
703 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescField(
704  SQLHDESC hdesc,
705  SQLSMALLINT icol,
706  SQLSMALLINT fDescType,
707  SQLPOINTER Value,
708  SQLINTEGER BufferLength,
709  SQLINTEGER * StringLength)
710 {
711  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescField(%p, %d, %d, %p, %d, %p)\n",
712  hdesc,
713  (int) icol,
714  (int) fDescType,
715  Value,
716  (int) BufferLength,
717  StringLength);
718 #ifdef ENABLE_ODBC_WIDE
719  return _SQLGetDescField(hdesc,
720  icol,
721  fDescType,
722  Value,
723  BufferLength,
724  StringLength, 0);
725 #else
726  return _SQLGetDescField(hdesc,
727  icol,
728  fDescType,
729  Value,
730  BufferLength,
731  StringLength);
732 #endif
733 }
734 
735 #ifdef ENABLE_ODBC_WIDE
736 static SQLRETURN _SQLSetDescField(SQLHDESC hdesc,
737  SQLSMALLINT icol,
738  SQLSMALLINT fDescType,
739  SQLPOINTER Value,
740  SQLINTEGER BufferLength, int wide);
741 
742 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescFieldW(
743  SQLHDESC hdesc,
744  SQLSMALLINT icol,
745  SQLSMALLINT fDescType,
746  SQLPOINTER Value,
747  SQLINTEGER BufferLength)
748 {
749  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescFieldW(%p, %d, %d, %p, %d)\n",
750  hdesc,
751  (int) icol,
752  (int) fDescType,
753  Value,
754  (int) BufferLength);
755  return _SQLSetDescField(hdesc,
756  icol,
757  fDescType,
758  Value,
759  BufferLength, 1);
760 }
761 #endif
762 
763 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescField(
764  SQLHDESC hdesc,
765  SQLSMALLINT icol,
766  SQLSMALLINT fDescType,
767  SQLPOINTER Value,
768  SQLINTEGER BufferLength)
769 {
770  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescField(%p, %d, %d, %p, %d)\n",
771  hdesc,
772  (int) icol,
773  (int) fDescType,
774  Value,
775  (int) BufferLength);
776 #ifdef ENABLE_ODBC_WIDE
777  return _SQLSetDescField(hdesc,
778  icol,
779  fDescType,
780  Value,
781  BufferLength, 0);
782 #else
783  return _SQLSetDescField(hdesc,
784  icol,
785  fDescType,
786  Value,
787  BufferLength);
788 #endif
789 }
790 
791 #ifdef ENABLE_ODBC_WIDE
792 static SQLRETURN _SQLExecDirect(SQLHSTMT hstmt,
793  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide);
794 
795 SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirectW(
796  SQLHSTMT hstmt,
797  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr)
798 {
799  if (TDS_UNLIKELY(tds_write_dump)) {
800  SQLWSTR_BUFS(1);
801  tdsdump_log(TDS_DBG_FUNC, "SQLExecDirectW(%p, %ls, %d)\n",
802  hstmt,
803  SQLWSTR(szSqlStr), (int) cbSqlStr);
804  SQLWSTR_FREE();
805  }
806  return _SQLExecDirect(hstmt,
807  (ODBC_CHAR*) szSqlStr, cbSqlStr, 1);
808 }
809 #endif
810 
811 SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirect(
812  SQLHSTMT hstmt,
813  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
814 {
815  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLExecDirect(%p, %s, %d)\n",
816  hstmt,
817  (const char*) szSqlStr, (int) cbSqlStr);
818 #ifdef ENABLE_ODBC_WIDE
819  return _SQLExecDirect(hstmt,
820  (ODBC_CHAR*) szSqlStr, cbSqlStr, 0);
821 #else
822  return _SQLExecDirect(hstmt,
823  szSqlStr, cbSqlStr);
824 #endif
825 }
826 
827 #ifdef ENABLE_ODBC_WIDE
828 static SQLRETURN _SQLPrepare(SQLHSTMT hstmt,
829  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide);
830 
831 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepareW(
832  SQLHSTMT hstmt,
833  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr)
834 {
835  if (TDS_UNLIKELY(tds_write_dump)) {
836  SQLWSTR_BUFS(1);
837  tdsdump_log(TDS_DBG_FUNC, "SQLPrepareW(%p, %ls, %d)\n",
838  hstmt,
839  SQLWSTR(szSqlStr), (int) cbSqlStr);
840  SQLWSTR_FREE();
841  }
842  return _SQLPrepare(hstmt,
843  (ODBC_CHAR*) szSqlStr, cbSqlStr, 1);
844 }
845 #endif
846 
847 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepare(
848  SQLHSTMT hstmt,
849  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
850 {
851  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrepare(%p, %s, %d)\n",
852  hstmt,
853  (const char*) szSqlStr, (int) cbSqlStr);
854 #ifdef ENABLE_ODBC_WIDE
855  return _SQLPrepare(hstmt,
856  (ODBC_CHAR*) szSqlStr, cbSqlStr, 0);
857 #else
858  return _SQLPrepare(hstmt,
859  szSqlStr, cbSqlStr);
860 #endif
861 }
862 
863 #ifdef ENABLE_ODBC_WIDE
864 static SQLRETURN _SQLSetCursorName(SQLHSTMT hstmt,
865  ODBC_CHAR * szCursor, SQLSMALLINT cbCursor, int wide);
866 
867 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorNameW(
868  SQLHSTMT hstmt,
869  SQLWCHAR * szCursor, SQLSMALLINT cbCursor)
870 {
871  if (TDS_UNLIKELY(tds_write_dump)) {
872  SQLWSTR_BUFS(1);
873  tdsdump_log(TDS_DBG_FUNC, "SQLSetCursorNameW(%p, %ls, %d)\n",
874  hstmt,
875  SQLWSTR(szCursor), (int) cbCursor);
876  SQLWSTR_FREE();
877  }
878  return _SQLSetCursorName(hstmt,
879  (ODBC_CHAR*) szCursor, cbCursor, 1);
880 }
881 #endif
882 
883 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorName(
884  SQLHSTMT hstmt,
885  SQLCHAR * szCursor, SQLSMALLINT cbCursor)
886 {
887  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetCursorName(%p, %s, %d)\n",
888  hstmt,
889  (const char*) szCursor, (int) cbCursor);
890 #ifdef ENABLE_ODBC_WIDE
891  return _SQLSetCursorName(hstmt,
892  (ODBC_CHAR*) szCursor, cbCursor, 0);
893 #else
894  return _SQLSetCursorName(hstmt,
895  szCursor, cbCursor);
896 #endif
897 }
898 
899 #ifdef ENABLE_ODBC_WIDE
900 static SQLRETURN _SQLGetCursorName(SQLHSTMT hstmt,
901  ODBC_CHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor, int wide);
902 
903 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorNameW(
904  SQLHSTMT hstmt,
905  SQLWCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor)
906 {
907  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorNameW(%p, %p, %d, %p)\n",
908  hstmt,
909  szCursor, (int) cbCursorMax, pcbCursor);
910  return _SQLGetCursorName(hstmt,
911  (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 1);
912 }
913 #endif
914 
915 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorName(
916  SQLHSTMT hstmt,
917  SQLCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor)
918 {
919  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorName(%p, %p, %d, %p)\n",
920  hstmt,
921  szCursor, (int) cbCursorMax, pcbCursor);
922 #ifdef ENABLE_ODBC_WIDE
923  return _SQLGetCursorName(hstmt,
924  (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 0);
925 #else
926  return _SQLGetCursorName(hstmt,
927  szCursor, cbCursorMax, pcbCursor);
928 #endif
929 }
930 
931 #ifdef ENABLE_ODBC_WIDE
932 static SQLRETURN _SQLColumns(SQLHSTMT hstmt,
933  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
934  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
935  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
936  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
937 
938 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnsW(
939  SQLHSTMT hstmt,
940  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
941  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
942  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
943  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
944 {
945  if (TDS_UNLIKELY(tds_write_dump)) {
946  SQLWSTR_BUFS(4);
947  tdsdump_log(TDS_DBG_FUNC, "SQLColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
948  hstmt,
949  SQLWSTR(szCatalogName), (int) cbCatalogName,
950  SQLWSTR(szSchemaName), (int) cbSchemaName,
951  SQLWSTR(szTableName), (int) cbTableName,
952  SQLWSTR(szColumnName), (int) cbColumnName);
953  SQLWSTR_FREE();
954  }
955  return _SQLColumns(hstmt,
956  (ODBC_CHAR*) szCatalogName, cbCatalogName,
957  (ODBC_CHAR*) szSchemaName, cbSchemaName,
958  (ODBC_CHAR*) szTableName, cbTableName,
959  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
960 }
961 #endif
962 
963 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumns(
964  SQLHSTMT hstmt,
965  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
966  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
967  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
968  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
969 {
970  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
971  hstmt,
972  (const char*) szCatalogName, (int) cbCatalogName,
973  (const char*) szSchemaName, (int) cbSchemaName,
974  (const char*) szTableName, (int) cbTableName,
975  (const char*) szColumnName, (int) cbColumnName);
976 #ifdef ENABLE_ODBC_WIDE
977  return _SQLColumns(hstmt,
978  (ODBC_CHAR*) szCatalogName, cbCatalogName,
979  (ODBC_CHAR*) szSchemaName, cbSchemaName,
980  (ODBC_CHAR*) szTableName, cbTableName,
981  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
982 #else
983  return _SQLColumns(hstmt,
984  szCatalogName, cbCatalogName,
985  szSchemaName, cbSchemaName,
986  szTableName, cbTableName,
987  szColumnName, cbColumnName);
988 #endif
989 }
990 
991 #ifdef ENABLE_ODBC_WIDE
992 static SQLRETURN _SQLGetConnectAttr(SQLHDBC hdbc,
993  SQLINTEGER Attribute,
994  SQLPOINTER Value,
995  SQLINTEGER BufferLength,
996  SQLINTEGER * StringLength, int wide);
997 
998 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttrW(
999  SQLHDBC hdbc,
1000  SQLINTEGER Attribute,
1001  SQLPOINTER Value,
1002  SQLINTEGER BufferLength,
1003  SQLINTEGER * StringLength)
1004 {
1005  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttrW(%p, %d, %p, %d, %p)\n",
1006  hdbc,
1007  (int) Attribute,
1008  Value,
1009  (int) BufferLength,
1010  StringLength);
1011  return _SQLGetConnectAttr(hdbc,
1012  Attribute,
1013  Value,
1014  BufferLength,
1015  StringLength, 1);
1016 }
1017 #endif
1018 
1019 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttr(
1020  SQLHDBC hdbc,
1021  SQLINTEGER Attribute,
1022  SQLPOINTER Value,
1023  SQLINTEGER BufferLength,
1024  SQLINTEGER * StringLength)
1025 {
1026  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttr(%p, %d, %p, %d, %p)\n",
1027  hdbc,
1028  (int) Attribute,
1029  Value,
1030  (int) BufferLength,
1031  StringLength);
1032 #ifdef ENABLE_ODBC_WIDE
1033  return _SQLGetConnectAttr(hdbc,
1034  Attribute,
1035  Value,
1036  BufferLength,
1037  StringLength, 0);
1038 #else
1039  return _SQLGetConnectAttr(hdbc,
1040  Attribute,
1041  Value,
1042  BufferLength,
1043  StringLength);
1044 #endif
1045 }
1046 
1047 #ifdef ENABLE_ODBC_WIDE
1048 static SQLRETURN _SQLSetConnectAttr(SQLHDBC hdbc,
1049  SQLINTEGER Attribute,
1050  SQLPOINTER ValuePtr,
1051  SQLINTEGER StringLength, int wide);
1052 
1053 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttrW(
1054  SQLHDBC hdbc,
1055  SQLINTEGER Attribute,
1056  SQLPOINTER ValuePtr,
1057  SQLINTEGER StringLength)
1058 {
1059  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttrW(%p, %d, %p, %d)\n",
1060  hdbc,
1061  (int) Attribute,
1062  ValuePtr,
1063  (int) StringLength);
1064  return _SQLSetConnectAttr(hdbc,
1065  Attribute,
1066  ValuePtr,
1067  StringLength, 1);
1068 }
1069 #endif
1070 
1071 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttr(
1072  SQLHDBC hdbc,
1073  SQLINTEGER Attribute,
1074  SQLPOINTER ValuePtr,
1075  SQLINTEGER StringLength)
1076 {
1077  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttr(%p, %d, %p, %d)\n",
1078  hdbc,
1079  (int) Attribute,
1080  ValuePtr,
1081  (int) StringLength);
1082 #ifdef ENABLE_ODBC_WIDE
1083  return _SQLSetConnectAttr(hdbc,
1084  Attribute,
1085  ValuePtr,
1086  StringLength, 0);
1087 #else
1088  return _SQLSetConnectAttr(hdbc,
1089  Attribute,
1090  ValuePtr,
1091  StringLength);
1092 #endif
1093 }
1094 
1095 #ifdef ENABLE_ODBC_WIDE
1096 static SQLRETURN _SQLSpecialColumns(SQLHSTMT hstmt,
1097  SQLUSMALLINT fColType,
1098  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1099  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1100  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1101  SQLUSMALLINT fScope,
1102  SQLUSMALLINT fNullable, int wide);
1103 
1104 SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumnsW(
1105  SQLHSTMT hstmt,
1106  SQLUSMALLINT fColType,
1107  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1108  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1109  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1110  SQLUSMALLINT fScope,
1111  SQLUSMALLINT fNullable)
1112 {
1113  if (TDS_UNLIKELY(tds_write_dump)) {
1114  SQLWSTR_BUFS(3);
1115  tdsdump_log(TDS_DBG_FUNC, "SQLSpecialColumnsW(%p, %u, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n",
1116  hstmt,
1117  (unsigned int) fColType,
1118  SQLWSTR(szCatalogName), (int) cbCatalogName,
1119  SQLWSTR(szSchemaName), (int) cbSchemaName,
1120  SQLWSTR(szTableName), (int) cbTableName,
1121  (unsigned int) fScope,
1122  (unsigned int) fNullable);
1123  SQLWSTR_FREE();
1124  }
1125  return _SQLSpecialColumns(hstmt,
1126  fColType,
1127  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1128  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1129  (ODBC_CHAR*) szTableName, cbTableName,
1130  fScope,
1131  fNullable, 1);
1132 }
1133 #endif
1134 
1135 SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumns(
1136  SQLHSTMT hstmt,
1137  SQLUSMALLINT fColType,
1138  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1139  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1140  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1141  SQLUSMALLINT fScope,
1142  SQLUSMALLINT fNullable)
1143 {
1144  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSpecialColumns(%p, %u, %s, %d, %s, %d, %s, %d, %u, %u)\n",
1145  hstmt,
1146  (unsigned int) fColType,
1147  (const char*) szCatalogName, (int) cbCatalogName,
1148  (const char*) szSchemaName, (int) cbSchemaName,
1149  (const char*) szTableName, (int) cbTableName,
1150  (unsigned int) fScope,
1151  (unsigned int) fNullable);
1152 #ifdef ENABLE_ODBC_WIDE
1153  return _SQLSpecialColumns(hstmt,
1154  fColType,
1155  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1156  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1157  (ODBC_CHAR*) szTableName, cbTableName,
1158  fScope,
1159  fNullable, 0);
1160 #else
1161  return _SQLSpecialColumns(hstmt,
1162  fColType,
1163  szCatalogName, cbCatalogName,
1164  szSchemaName, cbSchemaName,
1165  szTableName, cbTableName,
1166  fScope,
1167  fNullable);
1168 #endif
1169 }
1170 
1171 #ifdef ENABLE_ODBC_WIDE
1172 static SQLRETURN _SQLStatistics(SQLHSTMT hstmt,
1173  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1174  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1175  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1176  SQLUSMALLINT fUnique,
1177  SQLUSMALLINT fAccuracy, int wide);
1178 
1179 SQLRETURN ODBC_PUBLIC ODBC_API SQLStatisticsW(
1180  SQLHSTMT hstmt,
1181  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1182  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1183  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1184  SQLUSMALLINT fUnique,
1185  SQLUSMALLINT fAccuracy)
1186 {
1187  if (TDS_UNLIKELY(tds_write_dump)) {
1188  SQLWSTR_BUFS(3);
1189  tdsdump_log(TDS_DBG_FUNC, "SQLStatisticsW(%p, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n",
1190  hstmt,
1191  SQLWSTR(szCatalogName), (int) cbCatalogName,
1192  SQLWSTR(szSchemaName), (int) cbSchemaName,
1193  SQLWSTR(szTableName), (int) cbTableName,
1194  (unsigned int) fUnique,
1195  (unsigned int) fAccuracy);
1196  SQLWSTR_FREE();
1197  }
1198  return _SQLStatistics(hstmt,
1199  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1200  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1201  (ODBC_CHAR*) szTableName, cbTableName,
1202  fUnique,
1203  fAccuracy, 1);
1204 }
1205 #endif
1206 
1207 SQLRETURN ODBC_PUBLIC ODBC_API SQLStatistics(
1208  SQLHSTMT hstmt,
1209  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1210  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1211  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1212  SQLUSMALLINT fUnique,
1213  SQLUSMALLINT fAccuracy)
1214 {
1215  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLStatistics(%p, %s, %d, %s, %d, %s, %d, %u, %u)\n",
1216  hstmt,
1217  (const char*) szCatalogName, (int) cbCatalogName,
1218  (const char*) szSchemaName, (int) cbSchemaName,
1219  (const char*) szTableName, (int) cbTableName,
1220  (unsigned int) fUnique,
1221  (unsigned int) fAccuracy);
1222 #ifdef ENABLE_ODBC_WIDE
1223  return _SQLStatistics(hstmt,
1224  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1225  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1226  (ODBC_CHAR*) szTableName, cbTableName,
1227  fUnique,
1228  fAccuracy, 0);
1229 #else
1230  return _SQLStatistics(hstmt,
1231  szCatalogName, cbCatalogName,
1232  szSchemaName, cbSchemaName,
1233  szTableName, cbTableName,
1234  fUnique,
1235  fAccuracy);
1236 #endif
1237 }
1238 
1239 #ifdef ENABLE_ODBC_WIDE
1240 static SQLRETURN _SQLTables(SQLHSTMT hstmt,
1241  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1242  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1243  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1244  ODBC_CHAR * szTableType, SQLSMALLINT cbTableType, int wide);
1245 
1246 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablesW(
1247  SQLHSTMT hstmt,
1248  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1249  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1250  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1251  SQLWCHAR * szTableType, SQLSMALLINT cbTableType)
1252 {
1253  if (TDS_UNLIKELY(tds_write_dump)) {
1254  SQLWSTR_BUFS(4);
1255  tdsdump_log(TDS_DBG_FUNC, "SQLTablesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
1256  hstmt,
1257  SQLWSTR(szCatalogName), (int) cbCatalogName,
1258  SQLWSTR(szSchemaName), (int) cbSchemaName,
1259  SQLWSTR(szTableName), (int) cbTableName,
1260  SQLWSTR(szTableType), (int) cbTableType);
1261  SQLWSTR_FREE();
1262  }
1263  return _SQLTables(hstmt,
1264  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1265  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1266  (ODBC_CHAR*) szTableName, cbTableName,
1267  (ODBC_CHAR*) szTableType, cbTableType, 1);
1268 }
1269 #endif
1270 
1271 SQLRETURN ODBC_PUBLIC ODBC_API SQLTables(
1272  SQLHSTMT hstmt,
1273  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1274  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1275  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1276  SQLCHAR * szTableType, SQLSMALLINT cbTableType)
1277 {
1278  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTables(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
1279  hstmt,
1280  (const char*) szCatalogName, (int) cbCatalogName,
1281  (const char*) szSchemaName, (int) cbSchemaName,
1282  (const char*) szTableName, (int) cbTableName,
1283  (const char*) szTableType, (int) cbTableType);
1284 #ifdef ENABLE_ODBC_WIDE
1285  return _SQLTables(hstmt,
1286  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1287  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1288  (ODBC_CHAR*) szTableName, cbTableName,
1289  (ODBC_CHAR*) szTableType, cbTableType, 0);
1290 #else
1291  return _SQLTables(hstmt,
1292  szCatalogName, cbCatalogName,
1293  szSchemaName, cbSchemaName,
1294  szTableName, cbTableName,
1295  szTableType, cbTableType);
1296 #endif
1297 }
1298 
1299 #define tdsdump_log TDSDUMP_LOG_FAST
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:353
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:57