-
Notifications
You must be signed in to change notification settings - Fork 15
/
pgapifunc.h
359 lines (352 loc) · 13.9 KB
/
pgapifunc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*-------
* Module: pgapifunc.h
*
*-------
*/
#ifndef _PG_API_FUNC_H__
#define _PG_API_FUNC_H__
#include "psqlodbc.h"
#include <stdio.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Internal flags for catalog functions */
#define PODBC_NOT_SEARCH_PATTERN 1L
#define PODBC_SEARCH_PUBLIC_SCHEMA (1L << 1)
#define PODBC_SEARCH_BY_IDS (1L << 2)
#define PODBC_SHOW_OID_COLUMN (1L << 3)
#define PODBC_ROW_VERSIONING (1L << 4)
/* Internal flags for PGAPI_AllocStmt functions */
#define PODBC_EXTERNAL_STATEMENT 1L /* visible to the driver manager */
#define PODBC_INHERIT_CONNECT_OPTIONS (1L << 1)
/* Internal flags for PGAPI_Exec... functions */
#define PODBC_WITH_HOLD 1L
#define PODBC_RDONLY (1L << 1)
#define PODBC_RECYCLE_STATEMENT (1L << 2)
/* Flags for the error handling */
#define PODBC_ALLOW_PARTIAL_EXTRACT 1L
/* #define PODBC_ERROR_CLEAR (1L << 1) no longer used */
RETCODE SQL_API PGAPI_AllocConnect(HENV EnvironmentHandle,
HDBC * ConnectionHandle);
RETCODE SQL_API PGAPI_AllocEnv(HENV * EnvironmentHandle);
RETCODE SQL_API PGAPI_AllocStmt(HDBC ConnectionHandle,
HSTMT *StatementHandle, UDWORD flag);
RETCODE SQL_API PGAPI_BindCol(HSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
PTR TargetValue, SQLLEN BufferLength,
SQLLEN *StrLen_or_Ind);
RETCODE SQL_API PGAPI_Cancel(HSTMT StatementHandle);
RETCODE SQL_API PGAPI_Columns(HSTMT StatementHandle,
const SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
const SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
const SQLCHAR *TableName, SQLSMALLINT NameLength3,
const SQLCHAR *ColumnName, SQLSMALLINT NameLength4,
UWORD flag,
OID reloid,
Int2 attnum);
RETCODE SQL_API PGAPI_Connect(HDBC ConnectionHandle,
const SQLCHAR *ServerName, SQLSMALLINT NameLength1,
const SQLCHAR *UserName, SQLSMALLINT NameLength2,
const SQLCHAR *Authentication, SQLSMALLINT NameLength3);
RETCODE SQL_API PGAPI_DriverConnect(HDBC hdbc, HWND hwnd,
const SQLCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
SQLCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax,
SQLSMALLINT * pcbConnStrOut, SQLUSMALLINT fDriverCompletion);
RETCODE SQL_API PGAPI_BrowseConnect(HDBC hdbc,
const SQLCHAR *szConnStrIn, SQLSMALLINT cbConnStrIn,
SQLCHAR *szConnStrOut, SQLSMALLINT cbConnStrOutMax,
SQLSMALLINT *pcbConnStrOut);
RETCODE SQL_API PGAPI_DataSources(HENV EnvironmentHandle,
SQLUSMALLINT Direction, const SQLCHAR *ServerName,
SQLSMALLINT BufferLength1, SQLSMALLINT *NameLength1,
const SQLCHAR *Description, SQLSMALLINT BufferLength2,
SQLSMALLINT *NameLength2);
RETCODE SQL_API PGAPI_DescribeCol(HSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName,
SQLSMALLINT BufferLength, SQLSMALLINT *NameLength,
SQLSMALLINT *DataType, SQLULEN *ColumnSize,
SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable);
RETCODE SQL_API PGAPI_Disconnect(HDBC ConnectionHandle);
RETCODE SQL_API PGAPI_Error(HENV EnvironmentHandle,
HDBC ConnectionHandle, HSTMT StatementHandle,
SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
SQLCHAR *MessageText, SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength);
/* Helper functions for Error handling */
RETCODE SQL_API PGAPI_EnvError(HENV EnvironmentHandle, SQLSMALLINT RecNumber,
SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
SQLCHAR *MessageText, SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength, UWORD flag);
RETCODE SQL_API PGAPI_ConnectError(HDBC ConnectionHandle, SQLSMALLINT RecNumber,
SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
SQLCHAR *MessageText, SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength, UWORD flag);
RETCODE SQL_API PGAPI_StmtError(HSTMT StatementHandle, SQLSMALLINT RecNumber,
SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
SQLCHAR *MessageText, SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength, UWORD flag);
RETCODE SQL_API PGAPI_ExecDirect(HSTMT StatementHandle,
const SQLCHAR *StatementText, SQLINTEGER TextLength, UWORD flag);
RETCODE SQL_API PGAPI_Execute(HSTMT StatementHandle, UWORD flag);
RETCODE SQL_API PGAPI_Fetch(HSTMT StatementHandle);
RETCODE SQL_API PGAPI_FreeConnect(HDBC ConnectionHandle);
RETCODE SQL_API PGAPI_FreeEnv(HENV EnvironmentHandle);
RETCODE SQL_API PGAPI_FreeStmt(HSTMT StatementHandle,
SQLUSMALLINT Option);
RETCODE SQL_API PGAPI_GetConnectOption(HDBC ConnectionHandle,
SQLUSMALLINT Option, PTR Value,
SQLINTEGER *StringLength, SQLINTEGER BufferLength);
RETCODE SQL_API PGAPI_GetCursorName(HSTMT StatementHandle,
SQLCHAR *CursorName, SQLSMALLINT BufferLength,
SQLSMALLINT *NameLength);
RETCODE SQL_API PGAPI_GetData(HSTMT StatementHandle,
SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType,
PTR TargetValue, SQLLEN BufferLength,
SQLLEN *StrLen_or_Ind);
RETCODE SQL_API PGAPI_GetFunctions(HDBC ConnectionHandle,
SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported);
RETCODE SQL_API PGAPI_GetFunctions30(HDBC ConnectionHandle,
SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported);
RETCODE SQL_API PGAPI_GetInfo(HDBC ConnectionHandle,
SQLUSMALLINT InfoType, PTR InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength);
RETCODE SQL_API PGAPI_GetStmtOption(HSTMT StatementHandle,
SQLUSMALLINT Option, PTR Value,
SQLINTEGER *StringLength, SQLINTEGER BufferLength);
RETCODE SQL_API PGAPI_GetTypeInfo(HSTMT StatementHandle,
SQLSMALLINT DataType);
RETCODE SQL_API PGAPI_NumResultCols(HSTMT StatementHandle,
SQLSMALLINT *ColumnCount);
RETCODE SQL_API PGAPI_ParamData(HSTMT StatementHandle,
PTR *Value);
RETCODE SQL_API PGAPI_Prepare(HSTMT StatementHandle,
const SQLCHAR *StatementText, SQLINTEGER TextLength);
RETCODE SQL_API PGAPI_PutData(HSTMT StatementHandle,
PTR Data, SQLLEN StrLen_or_Ind);
RETCODE SQL_API PGAPI_RowCount(HSTMT StatementHandle,
SQLLEN *RowCount);
RETCODE SQL_API PGAPI_SetConnectOption(HDBC ConnectionHandle,
SQLUSMALLINT Option, SQLULEN Value);
RETCODE SQL_API PGAPI_SetCursorName(HSTMT StatementHandle,
const SQLCHAR *CursorName, SQLSMALLINT NameLength);
RETCODE SQL_API PGAPI_SetParam(HSTMT StatementHandle,
SQLUSMALLINT ParameterNumber, SQLSMALLINT ValueType,
SQLSMALLINT ParameterType, SQLULEN LengthPrecision,
SQLSMALLINT ParameterScale, PTR ParameterValue,
SQLLEN *StrLen_or_Ind);
RETCODE SQL_API PGAPI_SetStmtOption(HSTMT StatementHandle,
SQLUSMALLINT Option, SQLULEN Value);
RETCODE SQL_API PGAPI_SpecialColumns(HSTMT StatementHandle,
SQLUSMALLINT IdentifierType, const SQLCHAR *CatalogName,
SQLSMALLINT NameLength1, const SQLCHAR *SchemaName,
SQLSMALLINT NameLength2, const SQLCHAR *TableName,
SQLSMALLINT NameLength3, SQLUSMALLINT Scope,
SQLUSMALLINT Nullable);
RETCODE SQL_API PGAPI_Statistics(HSTMT StatementHandle,
const SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
const SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
const SQLCHAR *TableName, SQLSMALLINT NameLength3,
SQLUSMALLINT Unique, SQLUSMALLINT Reserved);
RETCODE SQL_API PGAPI_Tables(HSTMT StatementHandle,
const SQLCHAR *CatalogName, SQLSMALLINT NameLength1,
const SQLCHAR *SchemaName, SQLSMALLINT NameLength2,
const SQLCHAR *TableName, SQLSMALLINT NameLength3,
const SQLCHAR *TableType, SQLSMALLINT NameLength4,
UWORD flag);
RETCODE SQL_API PGAPI_Transact(HENV EnvironmentHandle,
HDBC ConnectionHandle, SQLUSMALLINT CompletionType);
RETCODE SQL_API PGAPI_ColAttributes(
HSTMT hstmt,
SQLUSMALLINT icol,
SQLUSMALLINT fDescType,
PTR rgbDesc,
SQLSMALLINT cbDescMax,
SQLSMALLINT *pcbDesc,
SQLLEN *pfDesc);
RETCODE SQL_API PGAPI_ColumnPrivileges(
HSTMT hstmt,
const SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
const SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
const SQLCHAR *szTableName,
SQLSMALLINT cbTableName,
const SQLCHAR *szColumnName,
SQLSMALLINT cbColumnName,
UWORD flag);
RETCODE SQL_API PGAPI_DescribeParam(
HSTMT hstmt,
SQLUSMALLINT ipar,
SQLSMALLINT *pfSqlType,
SQLULEN *pcbParamDef,
SQLSMALLINT *pibScale,
SQLSMALLINT *pfNullable);
RETCODE SQL_API PGAPI_ExtendedFetch(
HSTMT hstmt,
SQLUSMALLINT fFetchType,
SQLLEN irow,
SQLULEN *pcrow,
SQLUSMALLINT *rgfRowStatus,
SQLLEN FetchOffset,
SQLLEN rowsetSize);
RETCODE SQL_API PGAPI_ForeignKeys(
HSTMT hstmt,
const SQLCHAR *szPkCatalogName,
SQLSMALLINT cbPkCatalogName,
const SQLCHAR *szPkSchemaName,
SQLSMALLINT cbPkSchemaName,
const SQLCHAR *szPkTableName,
SQLSMALLINT cbPkTableName,
const SQLCHAR *szFkCatalogName,
SQLSMALLINT cbFkCatalogName,
const SQLCHAR *szFkSchemaName,
SQLSMALLINT cbFkSchemaName,
const SQLCHAR *szFkTableName,
SQLSMALLINT cbFkTableName);
RETCODE SQL_API PGAPI_MoreResults(
HSTMT hstmt);
RETCODE SQL_API PGAPI_NativeSql(
HDBC hdbc,
const SQLCHAR *szSqlStrIn,
SQLINTEGER cbSqlStrIn,
SQLCHAR *szSqlStr,
SQLINTEGER cbSqlStrMax,
SQLINTEGER *pcbSqlStr);
RETCODE SQL_API PGAPI_NumParams(
HSTMT hstmt,
SQLSMALLINT *pcpar);
RETCODE SQL_API PGAPI_ParamOptions(
HSTMT hstmt,
SQLULEN crow,
SQLULEN *pirow);
RETCODE SQL_API PGAPI_PrimaryKeys(
HSTMT hstmt,
const SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
const SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
const SQLCHAR *szTableName,
SQLSMALLINT cbTableName,
OID reloid);
RETCODE SQL_API PGAPI_ProcedureColumns(
HSTMT hstmt,
const SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
const SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
const SQLCHAR *szProcName,
SQLSMALLINT cbProcName,
const SQLCHAR *szColumnName,
SQLSMALLINT cbColumnName,
UWORD flag);
RETCODE SQL_API PGAPI_Procedures(
HSTMT hstmt,
const SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
const SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
const SQLCHAR *szProcName,
SQLSMALLINT cbProcName,
UWORD flag);
RETCODE SQL_API PGAPI_SetPos(
HSTMT hstmt,
SQLSETPOSIROW irow,
SQLUSMALLINT fOption,
SQLUSMALLINT fLock);
RETCODE SQL_API PGAPI_TablePrivileges(
HSTMT hstmt,
const SQLCHAR *szCatalogName,
SQLSMALLINT cbCatalogName,
const SQLCHAR *szSchemaName,
SQLSMALLINT cbSchemaName,
const SQLCHAR *szTableName,
SQLSMALLINT cbTableName,
UWORD flag);
RETCODE SQL_API PGAPI_BindParameter(
HSTMT hstmt,
SQLUSMALLINT ipar,
SQLSMALLINT fParamType,
SQLSMALLINT fCType,
SQLSMALLINT fSqlType,
SQLULEN cbColDef,
SQLSMALLINT ibScale,
PTR rgbValue,
SQLLEN cbValueMax,
SQLLEN *pcbValue);
RETCODE SQL_API PGAPI_SetScrollOptions(
HSTMT hstmt,
SQLUSMALLINT fConcurrency,
SQLLEN crowKeyset,
SQLUSMALLINT crowRowset);
RETCODE SQL_API PGAPI_GetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle,
SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
SQLINTEGER *NativeError, SQLCHAR *MessageText,
SQLSMALLINT BufferLength, SQLSMALLINT *TextLength);
RETCODE SQL_API PGAPI_GetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier,
PTR DiagInfoPtr, SQLSMALLINT BufferLength,
SQLSMALLINT *StringLengthPtr);
RETCODE SQL_API PGAPI_GetConnectAttr(HDBC ConnectionHandle,
SQLINTEGER Attribute, PTR Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength);
RETCODE SQL_API PGAPI_GetStmtAttr(HSTMT StatementHandle,
SQLINTEGER Attribute, PTR Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength);
/* Driver-specific connection attributes, for SQLSet/GetConnectAttr() */
enum {
SQL_ATTR_PGOPT_DEBUG = 65536
,SQL_ATTR_PGOPT_COMMLOG = 65537
,SQL_ATTR_PGOPT_PARSE = 65538
,SQL_ATTR_PGOPT_USE_DECLAREFETCH = 65539
,SQL_ATTR_PGOPT_SERVER_SIDE_PREPARE = 65540
,SQL_ATTR_PGOPT_FETCH = 65541
,SQL_ATTR_PGOPT_UNKNOWNSIZES = 65542
,SQL_ATTR_PGOPT_TEXTASLONGVARCHAR = 65543
,SQL_ATTR_PGOPT_UNKNOWNSASLONGVARCHAR = 65544
,SQL_ATTR_PGOPT_BOOLSASCHAR = 65545
,SQL_ATTR_PGOPT_MAXVARCHARSIZE = 65546
,SQL_ATTR_PGOPT_MAXLONGVARCHARSIZE = 65547
,SQL_ATTR_PGOPT_WCSDEBUG = 65548
,SQL_ATTR_PGOPT_MSJET = 65549
,SQL_ATTR_PGOPT_BATCHSIZE = 65550
,SQL_ATTR_PGOPT_IGNORETIMEOUT = 65551
};
RETCODE SQL_API PGAPI_SetConnectAttr(HDBC ConnectionHandle,
SQLINTEGER Attribute, PTR Value,
SQLINTEGER StringLength);
RETCODE SQL_API PGAPI_SetStmtAttr(HSTMT StatementHandle,
SQLINTEGER Attribute, PTR Value,
SQLINTEGER StringLength);
RETCODE SQL_API PGAPI_BulkOperations(HSTMT StatementHandle,
SQLSMALLINT operation);
RETCODE SQL_API PGAPI_AllocDesc(HDBC ConnectionHandle,
SQLHDESC *DescriptorHandle);
RETCODE SQL_API PGAPI_FreeDesc(SQLHDESC DescriptorHandle);
RETCODE SQL_API PGAPI_CopyDesc(SQLHDESC SourceDescHandle,
SQLHDESC TargetDescHandle);
RETCODE SQL_API PGAPI_SetDescField(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
PTR Value, SQLINTEGER BufferLength);
RETCODE SQL_API PGAPI_GetDescField(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength);
RETCODE SQL_API PGAPI_SetDescRec(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLSMALLINT Type,
SQLSMALLINT SubType, SQLLEN Length,
SQLSMALLINT Precision, SQLSMALLINT Scale,
PTR Data, SQLLEN *StringLength, SQLLEN *Indicator);
RETCODE SQL_API PGAPI_GetDescRec(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLCHAR *Name,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
SQLSMALLINT *Type, SQLSMALLINT *SubType,
SQLLEN *Length, SQLSMALLINT *Precision,
SQLSMALLINT *Scale, SQLSMALLINT *Nullable);
RETCODE SQL_API PGAPI_DescError(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber,
SQLCHAR *Sqlstate, SQLINTEGER *NativeError,
SQLCHAR *MessageText, SQLSMALLINT BufferLength,
SQLSMALLINT *TextLength, UWORD flag);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* define_PG_API_FUNC_H__ */