summaryrefslogtreecommitdiff
path: root/connectivity/source/inc/odbc/OFunctions.hxx
blob: c4808e75f6208da63295a52737df183714770e0f (plain)
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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#pragma once

#include <sal/config.h>

#include <connectivity/odbc.hxx>
#include <odbc/OTools.hxx>

namespace connectivity::odbc
{
// All ODBC wrapper method signatures must match respective SQL* ODBC API functions exactly
class Functions
{
public:
    virtual bool has(ODBC3SQLFunctionId id) const = 0;

    virtual SQLRETURN AllocHandle(SQLSMALLINT HandleType,
                                  SQLHANDLE InputHandle,
                                  SQLHANDLE* OutputHandlePtr) const = 0;
    virtual SQLRETURN DriverConnect(SQLHDBC ConnectionHandle,
                                    HWND WindowHandle,
                                    SQLCHAR* InConnectionString,
                                    SQLSMALLINT StringLength1,
                                    SQLCHAR* OutConnectionString,
                                    SQLSMALLINT BufferLength,
                                    SQLSMALLINT* StringLength2Ptr,
                                    SQLUSMALLINT DriverCompletion) const = 0;
    // Obtaining information about a driver and data source
    virtual SQLRETURN GetInfo(SQLHDBC ConnectionHandle,
                              SQLUSMALLINT InfoType,
                              SQLPOINTER InfoValuePtr,
                              SQLSMALLINT BufferLength,
                              SQLSMALLINT* StringLengthPtr) const = 0;
    virtual SQLRETURN GetFunctions(SQLHDBC ConnectionHandle,
                                   SQLUSMALLINT FunctionId,
                                   SQLUSMALLINT* SupportedPtr) const = 0;
    virtual SQLRETURN GetTypeInfo(SQLHSTMT StatementHandle, SQLSMALLINT DataType) const = 0;
    // Setting and retrieving driver attributes
    virtual SQLRETURN SetConnectAttr(SQLHDBC ConnectionHandle,
                                     SQLINTEGER Attribute,
                                     SQLPOINTER ValuePtr,
                                     SQLINTEGER StringLength) const = 0;
    virtual SQLRETURN GetConnectAttr(SQLHDBC ConnectionHandle,
                                     SQLINTEGER Attribute,
                                     SQLPOINTER ValuePtr,
                                     SQLINTEGER BufferLength,
                                     SQLINTEGER* StringLength) const = 0;
    virtual SQLRETURN SetEnvAttr(SQLHENV EnvironmentHandle,
                                 SQLINTEGER Attribute,
                                 SQLPOINTER ValuePtr,
                                 SQLINTEGER StringLength) const = 0;
    virtual SQLRETURN GetEnvAttr(SQLHENV EnvironmentHandle,
                                 SQLINTEGER Attribute,
                                 SQLPOINTER ValuePtr,
                                 SQLINTEGER BufferLength,
                                 SQLINTEGER* StringLength) const = 0;
    virtual SQLRETURN SetStmtAttr(SQLHSTMT StatementHandle,
                                  SQLINTEGER Attribute,
                                  SQLPOINTER ValuePtr,
                                  SQLINTEGER StringLength) const = 0;
    virtual SQLRETURN GetStmtAttr(SQLHSTMT StatementHandle,
                                  SQLINTEGER Attribute,
                                  SQLPOINTER ValuePtr,
                                  SQLINTEGER BufferLength,
                                  SQLINTEGER* StringLength) const = 0;
    // Setting and retrieving descriptor fields
    /*
    virtual SQLRETURN SetDescField(SQLHDESC DescriptorHandle,
                                   SQLSMALLINT RecNumber,
                                   SQLSMALLINT FieldIdentifier,
                                   SQLPOINTER ValuePtr,
                                   SQLINTEGER BufferLength) const = 0;
    virtual SQLRETURN GetDescField(SQLHDESC DescriptorHandle,
                                   SQLSMALLINT RecNumber,
                                   SQLSMALLINT FieldIdentifier,
                                   SQLPOINTER ValuePtr,
                                   SQLINTEGER BufferLength,
                                   SQLINTEGER* StringLengthPtr) const = 0;
    virtual SQLRETURN GetDescRec(SQLHDESC DescriptorHandle,
                                 SQLSMALLINT RecNumber,
                                 SQLCHAR* Name,
                                 SQLSMALLINT BufferLength,
                                 SQLSMALLINT* StringLengthPtr,
                                 SQLSMALLINT* TypePtr,
                                 SQLSMALLINT* SubTypePtr,
                                 SQLLEN* LengthPtr,
                                 SQLSMALLINT* PrecisionPtr,
                                 SQLSMALLINT* ScalePtr,
                                 SQLSMALLINT* NullablePtr) const = 0;
    virtual SQLRETURN SetDescRec(SQLHDESC DescriptorHandle,
                                 SQLSMALLINT RecNumber,
                                 SQLSMALLINT Type,
                                 SQLSMALLINT SubType,
                                 SQLLEN Length,
                                 SQLSMALLINT Precision,
                                 SQLSMALLINT Scale,
                                 SQLPOINTER DataPtr,
                                 SQLLEN* StringLengthPtr,
                                 SQLLEN* IndicatorPtr) const = 0;
    */
    // Preparing SQL requests
    virtual SQLRETURN Prepare(SQLHSTMT StatementHandle,
                              SQLCHAR* StatementText,
                              SQLINTEGER TextLength) const = 0;
    virtual SQLRETURN BindParameter(SQLHSTMT StatementHandle,
                                    SQLUSMALLINT ParameterNumber,
                                    SQLSMALLINT InputOutputType,
                                    SQLSMALLINT ValueType,
                                    SQLSMALLINT ParameterType,
                                    SQLULEN ColumnSize,
                                    SQLSMALLINT DecimalDigits,
                                    SQLPOINTER ParameterValuePtr,
                                    SQLLEN BufferLength,
                                    SQLLEN* StrLen_or_IndPtr) const = 0;
    /*
    virtual SQLRETURN GetCursorName(SQLHSTMT StatementHandle,
                                    SQLCHAR* CursorName,
                                    SQLSMALLINT BufferLength,
                                    SQLSMALLINT* NameLengthPtr) const = 0;
    */
    virtual SQLRETURN SetCursorName(SQLHSTMT StatementHandle,
                                    SQLCHAR* CursorName,
                                    SQLSMALLINT NameLength) const = 0;
    // Submitting requests
    virtual SQLRETURN Execute(SQLHSTMT StatementHandle) const = 0;
    virtual SQLRETURN ExecDirect(SQLHSTMT StatementHandle,
                                 SQLCHAR* StatementText,
                                 SQLINTEGER TextLength) const = 0;
    virtual SQLRETURN DescribeParam(SQLHSTMT StatementHandle,
                                    SQLUSMALLINT ParameterNumber,
                                    SQLSMALLINT* DataTypePtr,
                                    SQLULEN* ParameterSizePtr,
                                    SQLSMALLINT* DecimalDigitsPtr,
                                    SQLSMALLINT* NullablePtr) const = 0;
    virtual SQLRETURN NumParams(SQLHSTMT StatementHandle, SQLSMALLINT* ParameterCountPtr) const = 0;
    virtual SQLRETURN ParamData(SQLHSTMT StatementHandle, SQLPOINTER* ValuePtrPtr) const = 0;
    virtual SQLRETURN PutData(SQLHSTMT StatementHandle,
                              SQLPOINTER DataPtr,
                              SQLLEN StrLen_or_Ind) const = 0;
    // Retrieving results and information about results
    virtual SQLRETURN RowCount(SQLHSTMT StatementHandle, SQLLEN* RowCountPtr) const = 0;
    virtual SQLRETURN NumResultCols(SQLHSTMT StatementHandle, SQLSMALLINT* ColumnCountPtr) const = 0;
    virtual SQLRETURN ColAttribute(SQLHSTMT StatementHandle,
                                   SQLUSMALLINT ColumnNumber,
                                   SQLUSMALLINT FieldIdentifier,
                                   SQLPOINTER CharacterAttributePtr,
                                   SQLSMALLINT BufferLength,
                                   SQLSMALLINT* StringLengthPtr,
                                   SQLLEN* NumericAttributePtr) const = 0;
    virtual SQLRETURN BindCol(SQLHSTMT StatementHandle,
                              SQLUSMALLINT ColumnNumber,
                              SQLSMALLINT TargetType,
                              SQLPOINTER TargetValuePtr,
                              SQLLEN BufferLength,
                              SQLLEN* StrLen_or_IndPtr) const = 0;
    virtual SQLRETURN Fetch(SQLHSTMT StatementHandle) const = 0;
    virtual SQLRETURN FetchScroll(SQLHSTMT StatementHandle,
                                  SQLSMALLINT FetchOrientation,
                                  SQLLEN FetchOffset) const = 0;
    virtual SQLRETURN GetData(SQLHSTMT StatementHandle,
                              SQLUSMALLINT ColumnNumber,
                              SQLSMALLINT TargetType,
                              SQLPOINTER TargetValuePtr,
                              SQLLEN BufferLength,
                              SQLLEN* StrLen_or_IndPtr) const = 0;
    virtual SQLRETURN SetPos(SQLHSTMT StatementHandle,
                             SQLSETPOSIROW RowNumber,
                             SQLUSMALLINT Operation,
                             SQLUSMALLINT LockType) const = 0;
    virtual SQLRETURN BulkOperations(SQLHSTMT StatementHandle, SQLSMALLINT Operation) const = 0;
    virtual SQLRETURN MoreResults(SQLHSTMT StatementHandle) const = 0;
    /*
    virtual SQLRETURN GetDiagField(SQLSMALLINT HandleType,
                                   SQLHANDLE Handle,
                                   SQLSMALLINT RecNumber,
                                   SQLSMALLINT DiagIdentifier,
                                   SQLPOINTER DiagInfoPtr,
                                   SQLSMALLINT BufferLength,
                                   SQLSMALLINT* StringLengthPtr) const = 0;
    */
    virtual SQLRETURN GetDiagRec(SQLSMALLINT HandleType,
                                 SQLHANDLE Handle,
                                 SQLSMALLINT RecNumber,
                                 SQLCHAR* Sqlstate,
                                 SQLINTEGER* NativeErrorPtr,
                                 SQLCHAR* MessageText,
                                 SQLSMALLINT BufferLength,
                                 SQLSMALLINT* TextLengthPtr) const = 0;
    // Obtaining information about the data source's system tables (catalog functions)
    virtual SQLRETURN ColumnPrivileges(SQLHSTMT StatementHandle,
                                       SQLCHAR* CatalogName,
                                       SQLSMALLINT NameLength1,
                                       SQLCHAR* SchemaName,
                                       SQLSMALLINT NameLength2,
                                       SQLCHAR* TableName,
                                       SQLSMALLINT NameLength3,
                                       SQLCHAR* ColumnName,
                                       SQLSMALLINT NameLength4) const = 0;
    virtual SQLRETURN Columns(SQLHSTMT StatementHandle,
                              SQLCHAR* CatalogName,
                              SQLSMALLINT NameLength1,
                              SQLCHAR* SchemaName,
                              SQLSMALLINT NameLength2,
                              SQLCHAR* TableName,
                              SQLSMALLINT NameLength3,
                              SQLCHAR* ColumnName,
                              SQLSMALLINT NameLength4) const = 0;
    virtual SQLRETURN ForeignKeys(SQLHSTMT StatementHandle,
                                  SQLCHAR* PKCatalogName,
                                  SQLSMALLINT NameLength1,
                                  SQLCHAR* PKSchemaName,
                                  SQLSMALLINT NameLength2,
                                  SQLCHAR* PKTableName,
                                  SQLSMALLINT NameLength3,
                                  SQLCHAR* FKCatalogName,
                                  SQLSMALLINT NameLength4,
                                  SQLCHAR* FKSchemaName,
                                  SQLSMALLINT NameLength5,
                                  SQLCHAR* FKTableName,
                                  SQLSMALLINT NameLength6) const = 0;
    virtual SQLRETURN PrimaryKeys(SQLHSTMT StatementHandle,
                                  SQLCHAR* CatalogName,
                                  SQLSMALLINT NameLength1,
                                  SQLCHAR* SchemaName,
                                  SQLSMALLINT NameLength2,
                                  SQLCHAR* TableName,
                                  SQLSMALLINT NameLength3) const = 0;
    virtual SQLRETURN ProcedureColumns(SQLHSTMT StatementHandle,
                                       SQLCHAR* CatalogName,
                                       SQLSMALLINT NameLength1,
                                       SQLCHAR* SchemaName,
                                       SQLSMALLINT NameLength2,
                                       SQLCHAR* ProcName,
                                       SQLSMALLINT NameLength3,
                                       SQLCHAR* ColumnName,
                                       SQLSMALLINT NameLength4) const = 0;
    virtual SQLRETURN Procedures(SQLHSTMT StatementHandle,
                                 SQLCHAR* CatalogName,
                                 SQLSMALLINT NameLength1,
                                 SQLCHAR* SchemaName,
                                 SQLSMALLINT NameLength2,
                                 SQLCHAR* ProcName,
                                 SQLSMALLINT NameLength3) const = 0;
    virtual SQLRETURN SpecialColumns(SQLHSTMT StatementHandle,
                                     SQLUSMALLINT IdentifierType,
                                     SQLCHAR* CatalogName,
                                     SQLSMALLINT NameLength1,
                                     SQLCHAR* SchemaName,
                                     SQLSMALLINT NameLength2,
                                     SQLCHAR* TableName,
                                     SQLSMALLINT NameLength3,
                                     SQLUSMALLINT Scope,
                                     SQLUSMALLINT Nullable) const = 0;
    virtual SQLRETURN Statistics(SQLHSTMT StatementHandle,
                                 SQLCHAR* CatalogName,
                                 SQLSMALLINT NameLength1,
                                 SQLCHAR* SchemaName,
                                 SQLSMALLINT NameLength2,
                                 SQLCHAR* TableName,
                                 SQLSMALLINT NameLength3,
                                 SQLUSMALLINT Unique,
                                 SQLUSMALLINT Reserved) const = 0;
    virtual SQLRETURN TablePrivileges(SQLHSTMT StatementHandle,
                                      SQLCHAR* CatalogName,
                                      SQLSMALLINT NameLength1,
                                      SQLCHAR* SchemaName,
                                      SQLSMALLINT NameLength2,
                                      SQLCHAR* TableName,
                                      SQLSMALLINT NameLength3) const = 0;
    virtual SQLRETURN Tables(SQLHSTMT StatementHandle,
                             SQLCHAR* CatalogName,
                             SQLSMALLINT NameLength1,
                             SQLCHAR* SchemaName,
                             SQLSMALLINT NameLength2,
                             SQLCHAR* TableName,
                             SQLSMALLINT NameLength3,
                             SQLCHAR* TableType,
                             SQLSMALLINT NameLength4) const = 0;
    // Terminating a statement
    virtual SQLRETURN FreeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT Option) const = 0;
    virtual SQLRETURN CloseCursor(SQLHSTMT StatementHandle) const = 0;
    virtual SQLRETURN Cancel(SQLHSTMT StatementHandle) const = 0;
    virtual SQLRETURN EndTran(SQLSMALLINT HandleType,
                              SQLHANDLE Handle,
                              SQLSMALLINT CompletionType) const = 0;
    // Terminating a connection
    virtual SQLRETURN Disconnect(SQLHDBC ConnectionHandle) const = 0;
    virtual SQLRETURN FreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) const = 0;
    virtual SQLRETURN GetCursorName(SQLHSTMT StatementHandle,
                                    SQLCHAR* CursorName,
                                    SQLSMALLINT BufferLength,
                                    SQLSMALLINT* NameLength2) const = 0;
    virtual SQLRETURN NativeSql(SQLHDBC ConnectionHandle,
                                SQLCHAR* InStatementText,
                                SQLINTEGER TextLength1,
                                SQLCHAR* OutStatementText,
                                SQLINTEGER BufferLength,
                                SQLINTEGER* TextLength2Ptr) const = 0;
};
}


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */