FreeTDS API

Loading...
Searching...
No Matches
error_export.h
1#undef tdsdump_log
2
3#ifdef ENABLE_ODBC_WIDE
4 static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType,
5 SQLHANDLE handle,
6 SQLSMALLINT numRecord,
7 ODBC_CHAR * szSqlStat,
8 SQLINTEGER * pfNativeError,
9 ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
10
11SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW(
12 SQLSMALLINT handleType,
13 SQLHANDLE handle,
14 SQLSMALLINT numRecord,
15 SQLWCHAR * szSqlStat,
16 SQLINTEGER * pfNativeError,
17 SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
18{
19 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n",
20 (int) handleType,
21 handle,
22 (int) numRecord,
23 szSqlStat,
24 pfNativeError,
25 szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
26 return _SQLGetDiagRec(handleType,
27 handle,
28 numRecord,
29 (ODBC_CHAR*) szSqlStat,
30 pfNativeError,
31 (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
32}
33#endif
34
35SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec(
36 SQLSMALLINT handleType,
37 SQLHANDLE handle,
38 SQLSMALLINT numRecord,
39 SQLCHAR * szSqlStat,
40 SQLINTEGER * pfNativeError,
41 SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
42{
43 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n",
44 (int) handleType,
45 handle,
46 (int) numRecord,
47 szSqlStat,
48 pfNativeError,
49 szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
50#ifdef ENABLE_ODBC_WIDE
51 return _SQLGetDiagRec(handleType,
52 handle,
53 numRecord,
54 (ODBC_CHAR*) szSqlStat,
55 pfNativeError,
56 (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
57#else
58 return _SQLGetDiagRec(handleType,
59 handle,
60 numRecord,
61 szSqlStat,
62 pfNativeError,
63 szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
64#endif
65}
66
67#ifdef ENABLE_ODBC_WIDE
68 static SQLRETURN _SQLError(SQLHENV henv,
69 SQLHDBC hdbc,
70 SQLHSTMT hstmt,
71 ODBC_CHAR * szSqlStat,
72 SQLINTEGER * pfNativeError,
73 ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
74
75SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW(
76 SQLHENV henv,
77 SQLHDBC hdbc,
78 SQLHSTMT hstmt,
79 SQLWCHAR * szSqlStat,
80 SQLINTEGER * pfNativeError,
81 SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
82{
83 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n",
84 henv,
85 hdbc,
86 hstmt,
87 szSqlStat,
88 pfNativeError,
89 szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
90 return _SQLError(henv,
91 hdbc,
92 hstmt,
93 (ODBC_CHAR*) szSqlStat,
94 pfNativeError,
95 (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
96}
97#endif
98
99SQLRETURN ODBC_PUBLIC ODBC_API SQLError(
100 SQLHENV henv,
101 SQLHDBC hdbc,
102 SQLHSTMT hstmt,
103 SQLCHAR * szSqlStat,
104 SQLINTEGER * pfNativeError,
105 SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
106{
107 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n",
108 henv,
109 hdbc,
110 hstmt,
111 szSqlStat,
112 pfNativeError,
113 szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
114#ifdef ENABLE_ODBC_WIDE
115 return _SQLError(henv,
116 hdbc,
117 hstmt,
118 (ODBC_CHAR*) szSqlStat,
119 pfNativeError,
120 (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
121#else
122 return _SQLError(henv,
123 hdbc,
124 hstmt,
125 szSqlStat,
126 pfNativeError,
127 szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
128#endif
129}
130
131#ifdef ENABLE_ODBC_WIDE
132 static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType,
133 SQLHANDLE handle,
134 SQLSMALLINT numRecord,
135 SQLSMALLINT diagIdentifier,
136 SQLPOINTER buffer,
137 SQLSMALLINT cbBuffer,
138 SQLSMALLINT * pcbBuffer, int wide);
139
140SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW(
141 SQLSMALLINT handleType,
142 SQLHANDLE handle,
143 SQLSMALLINT numRecord,
144 SQLSMALLINT diagIdentifier,
145 SQLPOINTER buffer,
146 SQLSMALLINT cbBuffer,
147 SQLSMALLINT * pcbBuffer)
148{
149 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n",
150 (int) handleType,
151 handle,
152 (int) numRecord,
153 (int) diagIdentifier,
154 buffer,
155 (int) cbBuffer,
156 pcbBuffer);
157 return _SQLGetDiagField(handleType,
158 handle,
159 numRecord,
160 diagIdentifier,
161 buffer,
162 cbBuffer,
163 pcbBuffer, 1);
164}
165#endif
166
167SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField(
168 SQLSMALLINT handleType,
169 SQLHANDLE handle,
170 SQLSMALLINT numRecord,
171 SQLSMALLINT diagIdentifier,
172 SQLPOINTER buffer,
173 SQLSMALLINT cbBuffer,
174 SQLSMALLINT * pcbBuffer)
175{
176 TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n",
177 (int) handleType,
178 handle,
179 (int) numRecord,
180 (int) diagIdentifier,
181 buffer,
182 (int) cbBuffer,
183 pcbBuffer);
184#ifdef ENABLE_ODBC_WIDE
185 return _SQLGetDiagField(handleType,
186 handle,
187 numRecord,
188 diagIdentifier,
189 buffer,
190 cbBuffer,
191 pcbBuffer, 0);
192#else
193 return _SQLGetDiagField(handleType,
194 handle,
195 numRecord,
196 diagIdentifier,
197 buffer,
198 cbBuffer,
199 pcbBuffer);
200#endif
201}
202
203#define tdsdump_log TDSDUMP_LOG_FAST