1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/config.h>
24 #include <connectivity/odbc.hxx>
25 #include <odbc/OTools.hxx>
27 namespace connectivity::odbc
29 // All ODBC wrapper method signatures must match respective SQL* ODBC API functions exactly
33 virtual bool has(ODBC3SQLFunctionId id
) const = 0;
35 virtual SQLRETURN
AllocHandle(SQLSMALLINT HandleType
,
36 SQLHANDLE InputHandle
,
37 SQLHANDLE
* OutputHandlePtr
) const = 0;
38 virtual SQLRETURN
DriverConnect(SQLHDBC ConnectionHandle
,
40 SQLCHAR
* InConnectionString
,
41 SQLSMALLINT StringLength1
,
42 SQLCHAR
* OutConnectionString
,
43 SQLSMALLINT BufferLength
,
44 SQLSMALLINT
* StringLength2Ptr
,
45 SQLUSMALLINT DriverCompletion
) const = 0;
46 virtual SQLRETURN
DriverConnectW(SQLHDBC ConnectionHandle
,
48 SQLWCHAR
* InConnectionString
,
49 SQLSMALLINT StringLength1
,
50 SQLWCHAR
* OutConnectionString
,
51 SQLSMALLINT BufferLength
,
52 SQLSMALLINT
* StringLength2Ptr
,
53 SQLUSMALLINT DriverCompletion
) const = 0;
54 // Obtaining information about a driver and data source
55 virtual SQLRETURN
GetInfo(SQLHDBC ConnectionHandle
,
56 SQLUSMALLINT InfoType
,
57 SQLPOINTER InfoValuePtr
,
58 SQLSMALLINT BufferLength
,
59 SQLSMALLINT
* StringLengthPtr
) const = 0;
60 virtual SQLRETURN
GetInfoW(SQLHDBC ConnectionHandle
,
61 SQLUSMALLINT InfoType
,
62 SQLPOINTER InfoValuePtr
,
63 SQLSMALLINT BufferLength
,
64 SQLSMALLINT
* StringLengthPtr
) const = 0;
65 virtual SQLRETURN
GetFunctions(SQLHDBC ConnectionHandle
,
66 SQLUSMALLINT FunctionId
,
67 SQLUSMALLINT
* SupportedPtr
) const = 0;
68 virtual SQLRETURN
GetTypeInfo(SQLHSTMT StatementHandle
, SQLSMALLINT DataType
) const = 0;
69 // Setting and retrieving driver attributes
70 virtual SQLRETURN
SetConnectAttr(SQLHDBC ConnectionHandle
,
73 SQLINTEGER StringLength
) const = 0;
74 virtual SQLRETURN
SetConnectAttrW(SQLHDBC ConnectionHandle
,
77 SQLINTEGER StringLength
) const = 0;
78 virtual SQLRETURN
GetConnectAttr(SQLHDBC ConnectionHandle
,
81 SQLINTEGER BufferLength
,
82 SQLINTEGER
* StringLength
) const = 0;
83 virtual SQLRETURN
GetConnectAttrW(SQLHDBC ConnectionHandle
,
86 SQLINTEGER BufferLength
,
87 SQLINTEGER
* StringLength
) const = 0;
88 virtual SQLRETURN
SetEnvAttr(SQLHENV EnvironmentHandle
,
91 SQLINTEGER StringLength
) const = 0;
92 virtual SQLRETURN
GetEnvAttr(SQLHENV EnvironmentHandle
,
95 SQLINTEGER BufferLength
,
96 SQLINTEGER
* StringLength
) const = 0;
97 virtual SQLRETURN
SetStmtAttr(SQLHSTMT StatementHandle
,
100 SQLINTEGER StringLength
) const = 0;
101 virtual SQLRETURN
GetStmtAttr(SQLHSTMT StatementHandle
,
102 SQLINTEGER Attribute
,
104 SQLINTEGER BufferLength
,
105 SQLINTEGER
* StringLength
) const = 0;
106 // Setting and retrieving descriptor fields
108 virtual SQLRETURN SetDescField(SQLHDESC DescriptorHandle,
109 SQLSMALLINT RecNumber,
110 SQLSMALLINT FieldIdentifier,
112 SQLINTEGER BufferLength) const = 0;
113 virtual SQLRETURN GetDescField(SQLHDESC DescriptorHandle,
114 SQLSMALLINT RecNumber,
115 SQLSMALLINT FieldIdentifier,
117 SQLINTEGER BufferLength,
118 SQLINTEGER* StringLengthPtr) const = 0;
119 virtual SQLRETURN GetDescRec(SQLHDESC DescriptorHandle,
120 SQLSMALLINT RecNumber,
122 SQLSMALLINT BufferLength,
123 SQLSMALLINT* StringLengthPtr,
124 SQLSMALLINT* TypePtr,
125 SQLSMALLINT* SubTypePtr,
127 SQLSMALLINT* PrecisionPtr,
128 SQLSMALLINT* ScalePtr,
129 SQLSMALLINT* NullablePtr) const = 0;
130 virtual SQLRETURN SetDescRec(SQLHDESC DescriptorHandle,
131 SQLSMALLINT RecNumber,
135 SQLSMALLINT Precision,
138 SQLLEN* StringLengthPtr,
139 SQLLEN* IndicatorPtr) const = 0;
141 // Preparing SQL requests
142 virtual SQLRETURN
Prepare(SQLHSTMT StatementHandle
,
143 SQLCHAR
* StatementText
,
144 SQLINTEGER TextLength
) const = 0;
145 virtual SQLRETURN
PrepareW(SQLHSTMT StatementHandle
,
146 SQLWCHAR
* StatementText
,
147 SQLINTEGER TextLength
) const = 0;
148 virtual SQLRETURN
BindParameter(SQLHSTMT StatementHandle
,
149 SQLUSMALLINT ParameterNumber
,
150 SQLSMALLINT InputOutputType
,
151 SQLSMALLINT ValueType
,
152 SQLSMALLINT ParameterType
,
154 SQLSMALLINT DecimalDigits
,
155 SQLPOINTER ParameterValuePtr
,
157 SQLLEN
* StrLen_or_IndPtr
) const = 0;
159 virtual SQLRETURN GetCursorName(SQLHSTMT StatementHandle,
161 SQLSMALLINT BufferLength,
162 SQLSMALLINT* NameLengthPtr) const = 0;
164 virtual SQLRETURN
SetCursorName(SQLHSTMT StatementHandle
,
166 SQLSMALLINT NameLength
) const = 0;
167 virtual SQLRETURN
SetCursorNameW(SQLHSTMT StatementHandle
,
168 SQLWCHAR
* CursorName
,
169 SQLSMALLINT NameLength
) const = 0;
170 // Submitting requests
171 virtual SQLRETURN
Execute(SQLHSTMT StatementHandle
) const = 0;
172 virtual SQLRETURN
ExecDirect(SQLHSTMT StatementHandle
,
173 SQLCHAR
* StatementText
,
174 SQLINTEGER TextLength
) const = 0;
175 virtual SQLRETURN
ExecDirectW(SQLHSTMT StatementHandle
,
176 SQLWCHAR
* StatementText
,
177 SQLINTEGER TextLength
) const = 0;
178 virtual SQLRETURN
DescribeParam(SQLHSTMT StatementHandle
,
179 SQLUSMALLINT ParameterNumber
,
180 SQLSMALLINT
* DataTypePtr
,
181 SQLULEN
* ParameterSizePtr
,
182 SQLSMALLINT
* DecimalDigitsPtr
,
183 SQLSMALLINT
* NullablePtr
) const = 0;
184 virtual SQLRETURN
NumParams(SQLHSTMT StatementHandle
, SQLSMALLINT
* ParameterCountPtr
) const = 0;
185 virtual SQLRETURN
ParamData(SQLHSTMT StatementHandle
, SQLPOINTER
* ValuePtrPtr
) const = 0;
186 virtual SQLRETURN
PutData(SQLHSTMT StatementHandle
,
188 SQLLEN StrLen_or_Ind
) const = 0;
189 // Retrieving results and information about results
190 virtual SQLRETURN
RowCount(SQLHSTMT StatementHandle
, SQLLEN
* RowCountPtr
) const = 0;
191 virtual SQLRETURN
NumResultCols(SQLHSTMT StatementHandle
, SQLSMALLINT
* ColumnCountPtr
) const = 0;
192 virtual SQLRETURN
ColAttribute(SQLHSTMT StatementHandle
,
193 SQLUSMALLINT ColumnNumber
,
194 SQLUSMALLINT FieldIdentifier
,
195 SQLPOINTER CharacterAttributePtr
,
196 SQLSMALLINT BufferLength
,
197 SQLSMALLINT
* StringLengthPtr
,
198 SQLLEN
* NumericAttributePtr
) const = 0;
199 virtual SQLRETURN
ColAttributeW(SQLHSTMT StatementHandle
,
200 SQLUSMALLINT ColumnNumber
,
201 SQLUSMALLINT FieldIdentifier
,
202 SQLPOINTER CharacterAttributePtr
,
203 SQLSMALLINT BufferLength
,
204 SQLSMALLINT
* StringLengthPtr
,
205 SQLLEN
* NumericAttributePtr
) const = 0;
206 virtual SQLRETURN
BindCol(SQLHSTMT StatementHandle
,
207 SQLUSMALLINT ColumnNumber
,
208 SQLSMALLINT TargetType
,
209 SQLPOINTER TargetValuePtr
,
211 SQLLEN
* StrLen_or_IndPtr
) const = 0;
212 virtual SQLRETURN
Fetch(SQLHSTMT StatementHandle
) const = 0;
213 virtual SQLRETURN
FetchScroll(SQLHSTMT StatementHandle
,
214 SQLSMALLINT FetchOrientation
,
215 SQLLEN FetchOffset
) const = 0;
216 virtual SQLRETURN
GetData(SQLHSTMT StatementHandle
,
217 SQLUSMALLINT ColumnNumber
,
218 SQLSMALLINT TargetType
,
219 SQLPOINTER TargetValuePtr
,
221 SQLLEN
* StrLen_or_IndPtr
) const = 0;
222 virtual SQLRETURN
SetPos(SQLHSTMT StatementHandle
,
223 SQLSETPOSIROW RowNumber
,
224 SQLUSMALLINT Operation
,
225 SQLUSMALLINT LockType
) const = 0;
226 virtual SQLRETURN
BulkOperations(SQLHSTMT StatementHandle
, SQLSMALLINT Operation
) const = 0;
227 virtual SQLRETURN
MoreResults(SQLHSTMT StatementHandle
) const = 0;
229 virtual SQLRETURN GetDiagField(SQLSMALLINT HandleType,
231 SQLSMALLINT RecNumber,
232 SQLSMALLINT DiagIdentifier,
233 SQLPOINTER DiagInfoPtr,
234 SQLSMALLINT BufferLength,
235 SQLSMALLINT* StringLengthPtr) const = 0;
237 virtual SQLRETURN
GetDiagRec(SQLSMALLINT HandleType
,
239 SQLSMALLINT RecNumber
,
241 SQLINTEGER
* NativeErrorPtr
,
242 SQLCHAR
* MessageText
,
243 SQLSMALLINT BufferLength
,
244 SQLSMALLINT
* TextLengthPtr
) const = 0;
245 virtual SQLRETURN
GetDiagRecW(SQLSMALLINT HandleType
,
247 SQLSMALLINT RecNumber
,
249 SQLINTEGER
* NativeErrorPtr
,
250 SQLWCHAR
* MessageText
,
251 SQLSMALLINT BufferLength
,
252 SQLSMALLINT
* TextLengthPtr
) const = 0;
253 // Obtaining information about the data source's system tables (catalog functions)
254 virtual SQLRETURN
ColumnPrivileges(SQLHSTMT StatementHandle
,
255 SQLCHAR
* CatalogName
,
256 SQLSMALLINT NameLength1
,
258 SQLSMALLINT NameLength2
,
260 SQLSMALLINT NameLength3
,
262 SQLSMALLINT NameLength4
) const = 0;
263 virtual SQLRETURN
ColumnPrivilegesW(SQLHSTMT StatementHandle
,
264 SQLWCHAR
* CatalogName
,
265 SQLSMALLINT NameLength1
,
266 SQLWCHAR
* SchemaName
,
267 SQLSMALLINT NameLength2
,
269 SQLSMALLINT NameLength3
,
270 SQLWCHAR
* ColumnName
,
271 SQLSMALLINT NameLength4
) const = 0;
272 virtual SQLRETURN
Columns(SQLHSTMT StatementHandle
,
273 SQLCHAR
* CatalogName
,
274 SQLSMALLINT NameLength1
,
276 SQLSMALLINT NameLength2
,
278 SQLSMALLINT NameLength3
,
280 SQLSMALLINT NameLength4
) const = 0;
281 virtual SQLRETURN
ColumnsW(SQLHSTMT StatementHandle
,
282 SQLWCHAR
* CatalogName
,
283 SQLSMALLINT NameLength1
,
284 SQLWCHAR
* SchemaName
,
285 SQLSMALLINT NameLength2
,
287 SQLSMALLINT NameLength3
,
288 SQLWCHAR
* ColumnName
,
289 SQLSMALLINT NameLength4
) const = 0;
290 virtual SQLRETURN
ForeignKeys(SQLHSTMT StatementHandle
,
291 SQLCHAR
* PKCatalogName
,
292 SQLSMALLINT NameLength1
,
293 SQLCHAR
* PKSchemaName
,
294 SQLSMALLINT NameLength2
,
295 SQLCHAR
* PKTableName
,
296 SQLSMALLINT NameLength3
,
297 SQLCHAR
* FKCatalogName
,
298 SQLSMALLINT NameLength4
,
299 SQLCHAR
* FKSchemaName
,
300 SQLSMALLINT NameLength5
,
301 SQLCHAR
* FKTableName
,
302 SQLSMALLINT NameLength6
) const = 0;
303 virtual SQLRETURN
ForeignKeysW(SQLHSTMT StatementHandle
,
304 SQLWCHAR
* PKCatalogName
,
305 SQLSMALLINT NameLength1
,
306 SQLWCHAR
* PKSchemaName
,
307 SQLSMALLINT NameLength2
,
308 SQLWCHAR
* PKTableName
,
309 SQLSMALLINT NameLength3
,
310 SQLWCHAR
* FKCatalogName
,
311 SQLSMALLINT NameLength4
,
312 SQLWCHAR
* FKSchemaName
,
313 SQLSMALLINT NameLength5
,
314 SQLWCHAR
* FKTableName
,
315 SQLSMALLINT NameLength6
) const = 0;
316 virtual SQLRETURN
PrimaryKeys(SQLHSTMT StatementHandle
,
317 SQLCHAR
* CatalogName
,
318 SQLSMALLINT NameLength1
,
320 SQLSMALLINT NameLength2
,
322 SQLSMALLINT NameLength3
) const = 0;
323 virtual SQLRETURN
PrimaryKeysW(SQLHSTMT StatementHandle
,
324 SQLWCHAR
* CatalogName
,
325 SQLSMALLINT NameLength1
,
326 SQLWCHAR
* SchemaName
,
327 SQLSMALLINT NameLength2
,
329 SQLSMALLINT NameLength3
) const = 0;
330 virtual SQLRETURN
ProcedureColumns(SQLHSTMT StatementHandle
,
331 SQLCHAR
* CatalogName
,
332 SQLSMALLINT NameLength1
,
334 SQLSMALLINT NameLength2
,
336 SQLSMALLINT NameLength3
,
338 SQLSMALLINT NameLength4
) const = 0;
339 virtual SQLRETURN
ProcedureColumnsW(SQLHSTMT StatementHandle
,
340 SQLWCHAR
* CatalogName
,
341 SQLSMALLINT NameLength1
,
342 SQLWCHAR
* SchemaName
,
343 SQLSMALLINT NameLength2
,
345 SQLSMALLINT NameLength3
,
346 SQLWCHAR
* ColumnName
,
347 SQLSMALLINT NameLength4
) const = 0;
348 virtual SQLRETURN
Procedures(SQLHSTMT StatementHandle
,
349 SQLCHAR
* CatalogName
,
350 SQLSMALLINT NameLength1
,
352 SQLSMALLINT NameLength2
,
354 SQLSMALLINT NameLength3
) const = 0;
355 virtual SQLRETURN
ProceduresW(SQLHSTMT StatementHandle
,
356 SQLWCHAR
* CatalogName
,
357 SQLSMALLINT NameLength1
,
358 SQLWCHAR
* SchemaName
,
359 SQLSMALLINT NameLength2
,
361 SQLSMALLINT NameLength3
) const = 0;
362 virtual SQLRETURN
SpecialColumns(SQLHSTMT StatementHandle
,
363 SQLUSMALLINT IdentifierType
,
364 SQLCHAR
* CatalogName
,
365 SQLSMALLINT NameLength1
,
367 SQLSMALLINT NameLength2
,
369 SQLSMALLINT NameLength3
,
371 SQLUSMALLINT Nullable
) const = 0;
372 virtual SQLRETURN
SpecialColumnsW(SQLHSTMT StatementHandle
,
373 SQLUSMALLINT IdentifierType
,
374 SQLWCHAR
* CatalogName
,
375 SQLSMALLINT NameLength1
,
376 SQLWCHAR
* SchemaName
,
377 SQLSMALLINT NameLength2
,
379 SQLSMALLINT NameLength3
,
381 SQLUSMALLINT Nullable
) const = 0;
382 virtual SQLRETURN
Statistics(SQLHSTMT StatementHandle
,
383 SQLCHAR
* CatalogName
,
384 SQLSMALLINT NameLength1
,
386 SQLSMALLINT NameLength2
,
388 SQLSMALLINT NameLength3
,
390 SQLUSMALLINT Reserved
) const = 0;
391 virtual SQLRETURN
StatisticsW(SQLHSTMT StatementHandle
,
392 SQLWCHAR
* CatalogName
,
393 SQLSMALLINT NameLength1
,
394 SQLWCHAR
* SchemaName
,
395 SQLSMALLINT NameLength2
,
397 SQLSMALLINT NameLength3
,
399 SQLUSMALLINT Reserved
) const = 0;
400 virtual SQLRETURN
TablePrivileges(SQLHSTMT StatementHandle
,
401 SQLCHAR
* CatalogName
,
402 SQLSMALLINT NameLength1
,
404 SQLSMALLINT NameLength2
,
406 SQLSMALLINT NameLength3
) const = 0;
407 virtual SQLRETURN
TablePrivilegesW(SQLHSTMT StatementHandle
,
408 SQLWCHAR
* CatalogName
,
409 SQLSMALLINT NameLength1
,
410 SQLWCHAR
* SchemaName
,
411 SQLSMALLINT NameLength2
,
413 SQLSMALLINT NameLength3
) const = 0;
414 virtual SQLRETURN
Tables(SQLHSTMT StatementHandle
,
415 SQLCHAR
* CatalogName
,
416 SQLSMALLINT NameLength1
,
418 SQLSMALLINT NameLength2
,
420 SQLSMALLINT NameLength3
,
422 SQLSMALLINT NameLength4
) const = 0;
423 virtual SQLRETURN
TablesW(SQLHSTMT StatementHandle
,
424 SQLWCHAR
* CatalogName
,
425 SQLSMALLINT NameLength1
,
426 SQLWCHAR
* SchemaName
,
427 SQLSMALLINT NameLength2
,
429 SQLSMALLINT NameLength3
,
431 SQLSMALLINT NameLength4
) const = 0;
432 // Terminating a statement
433 virtual SQLRETURN
FreeStmt(SQLHSTMT StatementHandle
, SQLUSMALLINT Option
) const = 0;
434 virtual SQLRETURN
CloseCursor(SQLHSTMT StatementHandle
) const = 0;
435 virtual SQLRETURN
Cancel(SQLHSTMT StatementHandle
) const = 0;
436 virtual SQLRETURN
EndTran(SQLSMALLINT HandleType
,
438 SQLSMALLINT CompletionType
) const = 0;
439 // Terminating a connection
440 virtual SQLRETURN
Disconnect(SQLHDBC ConnectionHandle
) const = 0;
441 virtual SQLRETURN
FreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
) const = 0;
442 virtual SQLRETURN
GetCursorName(SQLHSTMT StatementHandle
,
444 SQLSMALLINT BufferLength
,
445 SQLSMALLINT
* NameLength2
) const = 0;
446 virtual SQLRETURN
GetCursorNameW(SQLHSTMT StatementHandle
,
447 SQLWCHAR
* CursorName
,
448 SQLSMALLINT BufferLength
,
449 SQLSMALLINT
* NameLength2
) const = 0;
450 virtual SQLRETURN
NativeSql(SQLHDBC ConnectionHandle
,
451 SQLCHAR
* InStatementText
,
452 SQLINTEGER TextLength1
,
453 SQLCHAR
* OutStatementText
,
454 SQLINTEGER BufferLength
,
455 SQLINTEGER
* TextLength2Ptr
) const = 0;
456 virtual SQLRETURN
NativeSqlW(SQLHDBC ConnectionHandle
,
457 SQLWCHAR
* InStatementText
,
458 SQLINTEGER TextLength1
,
459 SQLWCHAR
* OutStatementText
,
460 SQLINTEGER BufferLength
,
461 SQLINTEGER
* TextLength2Ptr
) const = 0;
466 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */