Products Support Documentation Download
sqlrext.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Raima Database Manager *
3  * *
4  * Copyright (c) 2011 Raima Inc. All rights reserved. *
5  * *
6  * Use of this software, whether in source code format, or in executable, *
7  * binary object code form, is governed by the Raima Inc. LICENSE *
8  * which is fully described in the LICENSE.TXT file, included within this *
9  * distribution of files. *
10  **************************************************************************/
11 
16 #if !defined(SQLREXT_H_INCLUDED_)
17 #define SQLREXT_H_INCLUDED_
18 
19 #include "sqlext.h"
20 #include "sqlrtypes.h"
21 
22 /* ------------------------------------------------------------------------
23  Values referenced in SQLGetInfo()
24 */
25 #define RDM_DRIVER_VER RDM_ODBC_DRIVER_VERSION
26 #define RDM_SOURCE_VER RDM_ODBC_DRIVER_VERSION
27 #define RDM_MAX_STATEMENT_LEN 4096 /* defSqlMaxstmtlen */
28 #define RDM_MAX_USER_NAME_LEN 32
29 #define RDM_INFO_LAST SQL_CONVERT_GUID /* sqlext.h */
30 #define RDM_XOPEN_INFO_FIRST SQL_XOPEN_CLI_YEAR
31 #if (ODBCVER >= 0x0380)
32 #define RDM_XOPEN_INFO_LAST SQL_ASYNC_DBC_FUNCTIONS
33 #else
34 #define RDM_XOPEN_INFO_LAST SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
35 #endif
36 
37 /* ------------------------------------------------------------------------
38  RDM specific transaction options for SQLExtendedTran()
39 */
40 #define SQL_START 2
41 #define SQL_SAVEPOINT 3
42 #define SQL_RELEASE 4
43 #define SQL_PRECOMMIT 5
44 
45 /* ------------------------------------------------------------------------
46  RDM specific transaction statuses for SQLTransactStatus()
47 */
48 #define SQL_TXN_INACTIVE 0
49 #define SQL_TXN_UPDATE 1
50 #define SQL_TXN_READ 2
51 #define SQL_TXN_SNAPSHOT 3
52 #define SQL_TXN_DDL 4
53 
54 /* ------------------------------------------------------------------------
55  RDM specific TFS type values
56 */
57 #define SQL_TFSTYPE_EMBED ((SQLUINTEGER) TFS_TYPE_EMBED)
58 #define SQL_TFSTYPE_REMOTE ((SQLUINTEGER) TFS_TYPE_CLIENT)
59 #define SQL_TFSTYPE_HYBRID ((SQLUINTEGER) TFS_TYPE_HYBRID)
60 #define SQL_TFSTYPE_DEFAULT ((SQLUINTEGER) TFS_TYPE_DEFAULT)
61 
62 /* ------------------------------------------------------------------------
63  RDM specific TFS port number definition
64 */
65 #define SQL_RDM_DEFAULT_PORT TFS_DEFAULT_PORT
66 
67 /* ------------------------------------------------------------------------
68  RDM specific TFS stdout definition
69 */
70 #define SQL_RDM_DEFAULT_STDOUT ""
71 
72 /* ------------------------------------------------------------------------
73  Maximum string size for the ODBC TFS type string
74 */
75 #define TFSTYPE_MAXSIZE 8 /* "default" + 1 */
76 
77 /* ------------------------------------------------------------------------
78  RDM specific dynamic function codes
79 */
80 #define SQL_DIAG_RDM_OPEN_DB 101
81 #define SQL_DIAG_RDM_OPEN_DBUNION 102
82 #define SQL_DIAG_RDM_CLOSE_DB 103
83 #define SQL_DIAG_RDM_SELECT 104
84 #define SQL_DIAG_RDM_START 105
85 #define SQL_DIAG_RDM_COMMIT 106
86 #define SQL_DIAG_RDM_SAVEPOINT 107
87 #define SQL_DIAG_RDM_RELEASE 108
88 #define SQL_DIAG_RDM_ROLLBACK 109
89 #define SQL_DIAG_RDM_PRECOMMIT 110
90 #define SQL_DIAG_RDM_CREATE_PROCEDURE 111
91 #define SQL_DIAG_RDM_DROP_PROCEDURE 112
92 #define SQL_DIAG_RDM_SET 113
93 #define SQL_DIAG_RDM_SET_COLUMN 114
94 #define SQL_DIAG_RDM_LOCK 115
95 #define SQL_DIAG_RDM_UNLOCK 116
96 #define SQL_DIAG_RDM_INITIALIZE_SCHEMA 117
97 #define SQL_DIAG_RDM_CREATE_CATALOG 118
98 #define SQL_DIAG_RDM_IMPORT_TABLE 119
99 #define SQL_DIAG_RDM_EXPORT_TABLE 120
100 #define SQL_DIAG_RDM_UPDATE_STATS 121
101 #define SQL_DIAG_RDM_CREATE_ENCKEY 122
102 #define SQL_DIAG_RDM_DROP_ENCKEY 123
103 #define SQL_DIAG_RDM_SET_DB_ENC 124
104 #define SQL_DIAG_RDM_DECLARE_VAR 125
105 #define SQL_DIAG_RDM_ASSIGN 126
106 #define SQL_DIAG_RDM_GOTO 127
107 #define SQL_DIAG_RDM_CREATE_TRIGGER 128
108 #define SQL_DIAG_RDM_DROP_TRIGGER 129
109 
110 /* ------------------------------------------------------------------------
111  RDM specific statement type defines for SQLDescribeStmt
112 */
113 #define SQL_RDM_STMT_UNKNOWN SQL_DIAG_UNKNOWN_STATEMENT
114 #define SQL_RDM_STMT_OPEN SQL_DIAG_RDM_OPEN_DB
115 #define SQL_RDM_STMT_DBUNION SQL_DIAG_RDM_OPEN_DBUNION
116 #define SQL_RDM_STMT_CLOSE SQL_DIAG_RDM_CLOSE_DB
117 #define SQL_RDM_STMT_SELECT SQL_DIAG_RDM_SELECT
118 #define SQL_RDM_STMT_INSERT SQL_DIAG_INSERT
119 #define SQL_RDM_STMT_UPDATE SQL_DIAG_UPDATE_WHERE
120 #define SQL_RDM_STMT_DELETE SQL_DIAG_DELETE_WHERE
121 #define SQL_RDM_STMT_START SQL_DIAG_RDM_START
122 #define SQL_RDM_STMT_COMMIT SQL_DIAG_RDM_COMMIT
123 #define SQL_RDM_STMT_SAVEPOINT SQL_DIAG_RDM_SAVEPOINT
124 #define SQL_RDM_STMT_RELEASE SQL_DIAG_RDM_RELEASE
125 #define SQL_RDM_STMT_ROLLBACK SQL_DIAG_RDM_ROLLBACK
126 #define SQL_RDM_STMT_CRPROC SQL_DIAG_RDM_CREATE_PROCEDURE
127 #define SQL_RDM_STMT_DRPROC SQL_DIAG_RDM_DROP_PROCEDURE
128 #define SQL_RDM_STMT_EXECUTE SQL_DIAG_RDM_EXECUTE_PROCEDURE
129 #define SQL_RDM_STMT_SET SQL_DIAG_RDM_SET
130 #define SQL_RDM_STMT_SETCOLUMN SQL_DIAG_RDM_SET_COLUMN
131 #define SQL_RDM_STMT_LOCK SQL_DIAG_RDM_LOCK
132 #define SQL_RDM_STMT_UNLOCK SQL_DIAG_RDM_UNLOCK
133 #define SQL_RDM_STMT_INITDB SQL_DIAG_RDM_INITIALIZE_SCHEMA
134 #define SQL_RDM_STMT_CRCAT SQL_DIAG_RDM_CREATE_CATALOG
135 #define SQL_RDM_STMT_IMPORT SQL_DIAG_RDM_IMPORT_TABLE
136 #define SQL_RDM_STMT_EXPORT SQL_DIAG_RDM_EXPORT_TABLE
137 #define SQL_RDM_STMT_DDL SQL_DIAG_CREATE_SCHEMA
138 
139 /* ------------------------------------------------------------------------
140  RDM specific error callback function definition
141 */
142 typedef int32_t (
143  SQL_API_PTR ECALLBACK) (int16_t, SQLHANDLE, SQLRETURN, const void *);
144 
145 /* ------------------------------------------------------------------------
146  RDM specific ODBC extension APIs
147 */
148 
149 #if defined(__cplusplus)
150 extern "C" {
151 #endif
152 
156 RDBC_EXPORT SQLRETURN SQL_API SQLDescribeStmt (
157  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
158  SQLUSMALLINT *pStmtType /* OUT: statement type */
159 );
160 
164 RDBC_EXPORT SQLRETURN SQL_API SQLExtendedTran (
165  SQLSMALLINT HandleType, /* IN: handle type */
166  SQLHANDLE Handle, /* IN: \RDBC handle */
167  SQLSMALLINT OperationType, /* IN: transaction type indicator */
168  SQLSMALLINT TransactionType, /* IN: \RDBC transaction type */
169  const SQLCHAR *TransactionID, /* IN: transaction ID (can be NULL) */
170  SQLSMALLINT StringLengthPtr /* IN: length of transaction ID */
171 );
172 
173 #if defined(RDM_UNICODE)
174 RDBC_EXPORT SQLRETURN SQL_API SQLExtendedTranW (
175  SQLSMALLINT HandleType, /* IN: handle type */
176  SQLHANDLE Handle, /* IN: \RDBC handle */
177  SQLSMALLINT OperationType, /* IN: transaction type indicator */
178  SQLSMALLINT TransactionType, /* IN: \RDBC transaction type */
179  const SQLWCHAR *TransactionID, /* IN: transaction ID (can be NULL) */
180  SQLSMALLINT StringLengthPtr /* IN: length of transaction ID */
181 );
182 #endif
183 
188  SQLHSTMT StatementHandle,
189  SQLUSMALLINT *pStmtType
190 );
191 
195 RDBC_EXPORT SQLRETURN SQL_API SQLRowId (
196  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
197  const SQLCHAR *TableName, /* IN: Name of the table */
198  SQLROWID *pRowid /* OUT: retrieved ROWID value */
199 );
200 
201 #if defined(RDM_UNICODE)
202 RDBC_EXPORT SQLRETURN SQL_API SQLRowIdW (
203  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
204  const SQLWCHAR *TableName, /* IN: Name of the table */
205  SQLROWID *pRowid /* OUT: retrieved ROWID value */
206 );
207 #endif
208 
212 RDBC_EXPORT SQLRETURN SQL_API SQLSetError (
213  SQLSMALLINT HandleType, /* IN: handle type */
214  SQLHANDLE Handle, /* IN: ODBC handle */
215  SQLRETURN ErrorCode, /* IN: ODBC stat code */
216  ECALLBACK ErrorHandler /* IN: ptr to the user error function */
217 );
218 
222 RDBC_EXPORT SQLRETURN SQL_API SQLSetErrorEx (
223  SQLSMALLINT HandleType, /* IN: handle type */
224  SQLHANDLE Handle, /* IN: ODBC handle */
225  SQLRETURN ErrorCode, /* IN: ODBC stat code */
226  ECALLBACK ErrorHandler, /* IN: ptr to the user error function */
227  void *pCtx /* IN: user error context */
228 );
229 
233 RDBC_EXPORT SQLRETURN SQL_API SQLShowPlan (
234  SQLHSTMT StatementHandle, /* IN: ODBC statement handle for plan */
235  SQLHSTMT QueryHandle /* IN: ODBC statement handle for query */
236 );
237 
241 RDBC_EXPORT SQLRETURN SQL_API SQLTransactStatus (
242  SQLSMALLINT HandleType, /* IN: handle type */
243  SQLHANDLE Handle, /* IN: ODBC handle */
244  SQLSMALLINT *pActive /* OUT: TRUE if tranaction is active */
245 );
246 
247 #define SQLExtendedTranA SQLExtendedTran
248 #define SQLRowIdA SQLRowId
249 
250 #if !defined(SQL_NOUNICODEMAP) /* define this to disable the mapping */
251 #if defined(_UNICODE)
252 #define SQLExtendedTran SQLExtendedTranW
253 #define SQLRowId SQLRowIdW
254 #endif
255 #endif
256 
257 #if defined(__cplusplus)
258 }
259 #endif
260 
261 #endif /* SQLREXT_H_INCLUDED_ */
RDBC_EXPORT SQLRETURN SQLGetStatementType(SQLHSTMT StatementHandle, SQLUSMALLINT *pStmtType)
Obtain the RDM SQL statement type.
RDBC_EXPORT SQLRETURN SQLSetErrorEx(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLRETURN ErrorCode, ECALLBACK ErrorHandler, void *pCtx)
Set the user-defined error handling routine for the specified handle.
RDBC_EXPORT SQLRETURN SQLRowId(SQLHSTMT StatementHandle, const SQLCHAR *TableName, SQLROWID *pRowid)
Retrieve the ROWID value of the current row.
RDBC_EXPORT SQLRETURN SQLExtendedTran(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT OperationType, SQLSMALLINT TransactionType, const SQLCHAR *TransactionID, SQLSMALLINT StringLengthPtr)
Perform an RDM specific transaction (start, mark, etc.)
Header for RDM ODBC Level-1 types.
wchar_t SQLWCHAR
Definition: sqltypes.h:77
int32_t(* ECALLBACK)(int16_t, SQLHANDLE, SQLRETURN, const void *)
Definition: sqlrext.h:143
int16_t SQLRETURN
SQL API Return Codes.
Definition: sqltypes.h:76
uint8_t SQLCHAR
Definition: sqltypes.h:52
const void * SQLHANDLE
Definition: sqltypes.h:98
RDM_ROWID_T SQLROWID
Definition: sqlrtypes.h:49
uint16_t SQLUSMALLINT
Definition: sqltypes.h:54
RDBC_EXPORT SQLRETURN SQLShowPlan(SQLHSTMT StatementHandle, SQLHSTMT QueryHandle)
Return the command execution plan chosen by the query optimizer.
#define SQL_API_PTR
Definition: sqltypes.h:44
RDBC_EXPORT SQLRETURN SQLSetError(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLRETURN ErrorCode, ECALLBACK ErrorHandler)
Set the user-defined error handling routine for the specified handle.
RDBC_EXPORT SQLRETURN SQLTransactStatus(SQLSMALLINT HandleType, SQLHANDLE Handle, SQLSMALLINT *pActive)
Return the status of an ongoing transaction.
Header for the Microsoft SQL Extensions.
#define SQL_API
Definition: sqltypes.h:43
RDBC_EXPORT SQLRETURN SQLDescribeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT *pStmtType)
Obtain the type of the latest executed statement.
int16_t SQLSMALLINT
Definition: sqltypes.h:53