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