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 #if defined(__cplusplus) && !defined(CPP_HEADER_INCLUDED)
20 #error sqlrext.h is only for C applications. Do not include it directly in C++ applications. Use cpp-sqlrext.h instead
21 #endif
22 
23 #include "sqlext.h"
24 #include "sqlrtypes.h"
25 
26 
27 /* ------------------------------------------------------------------------
28  Values referenced in SQLGetInfo()
29 */
30 #define RDM_DRIVER_VER RDM_ODBC_DRIVER_VERSION
31 #define RDM_SOURCE_VER RDM_ODBC_DRIVER_VERSION
32 #define RDM_MAX_STATEMENT_LEN 4096 /* defSqlMaxstmtlen */
33 #define RDM_MAX_USER_NAME_LEN 32
34 #define RDM_INFO_LAST SQL_CONVERT_GUID /* sqlext.h */
35 #define RDM_XOPEN_INFO_FIRST SQL_XOPEN_CLI_YEAR
36 #if (ODBCVER >= 0x0380)
37 #define RDM_XOPEN_INFO_LAST SQL_ASYNC_DBC_FUNCTIONS
38 #else
39 #define RDM_XOPEN_INFO_LAST SQL_MAX_ASYNC_CONCURRENT_STATEMENTS
40 #endif
41 
42 /* ------------------------------------------------------------------------
43  RDM specific transaction options for SQLExtendedTran()
44 */
45 #define SQL_START 2
46 #define SQL_SAVEPOINT 3
47 #define SQL_RELEASE 4
48 #define SQL_PRECOMMIT 5
49 
50 /* ------------------------------------------------------------------------
51  RDM specific transaction statuses for SQLTransactStatus()
52 */
53 #define SQL_TXN_INACTIVE 0
54 #define SQL_TXN_UPDATE 1
55 #define SQL_TXN_READ 2
56 #define SQL_TXN_SNAPSHOT 3
57 #define SQL_TXN_DDL 4
58 
59 /* ------------------------------------------------------------------------
60  RDM specific TFS type values
61 */
62 #define SQL_TFSTYPE_EMBED ((SQLUINTEGER) TFS_TYPE_EMBED)
63 #define SQL_TFSTYPE_REMOTE ((SQLUINTEGER) TFS_TYPE_REMOTE)
64 #define SQL_TFSTYPE_HYBRID ((SQLUINTEGER) TFS_TYPE_HYBRID)
65 #define SQL_TFSTYPE_DEFAULT ((SQLUINTEGER) TFS_TYPE_DEFAULT)
66 
67 /* ------------------------------------------------------------------------
68  RDM specific TFS port number definition
69 */
70 #define SQL_RDM_DEFAULT_PORT TFS_DEFAULT_PORT
71 
72 /* ------------------------------------------------------------------------
73  RDM specific TFS stdout definition
74 */
75 #define SQL_RDM_DEFAULT_STDOUT ""
76 
77 /* ------------------------------------------------------------------------
78  Maximum string size for the ODBC TFS type string
79 */
80 #define TFSTYPE_MAXSIZE 8 /* "default" + 1 */
81 
82 /* ------------------------------------------------------------------------
83  RDM specific dynamic function codes
84 */
85 #define SQL_DIAG_RDM_OPEN_DB 101
86 #define SQL_DIAG_RDM_OPEN_DBUNION 102
87 #define SQL_DIAG_RDM_CLOSE_DB 103
88 #define SQL_DIAG_RDM_SELECT 104
89 #define SQL_DIAG_RDM_START 105
90 #define SQL_DIAG_RDM_COMMIT 106
91 #define SQL_DIAG_RDM_SAVEPOINT 107
92 #define SQL_DIAG_RDM_RELEASE 108
93 #define SQL_DIAG_RDM_ROLLBACK 109
94 #define SQL_DIAG_RDM_PRECOMMIT 110
95 #define SQL_DIAG_RDM_CREATE_PROCEDURE 111
96 #define SQL_DIAG_RDM_DROP_PROCEDURE 112
97 #define SQL_DIAG_RDM_SET 113
98 #define SQL_DIAG_RDM_SET_COLUMN 114
99 #define SQL_DIAG_RDM_LOCK 115
100 #define SQL_DIAG_RDM_UNLOCK 116
101 #define SQL_DIAG_RDM_INITIALIZE_SCHEMA 117
102 #define SQL_DIAG_RDM_CREATE_CATALOG 118
103 #define SQL_DIAG_RDM_IMPORT_TABLE 119
104 #define SQL_DIAG_RDM_EXPORT_TABLE 120
105 #define SQL_DIAG_RDM_UPDATE_STATS 121
106 #define SQL_DIAG_RDM_CREATE_ENCKEY 122
107 #define SQL_DIAG_RDM_DROP_ENCKEY 123
108 #define SQL_DIAG_RDM_SET_DB_ENC 124
109 #define SQL_DIAG_RDM_DECLARE_VAR 125
110 #define SQL_DIAG_RDM_ASSIGN 126
111 #define SQL_DIAG_RDM_GOTO 127
112 #define SQL_DIAG_RDM_CREATE_TRIGGER 128
113 #define SQL_DIAG_RDM_DROP_TRIGGER 129
114 
115 /* ------------------------------------------------------------------------
116  RDM specific statement type defines for SQLDescribeStmt
117 */
118 #define SQL_RDM_STMT_UNKNOWN SQL_DIAG_UNKNOWN_STATEMENT
119 #define SQL_RDM_STMT_OPEN SQL_DIAG_RDM_OPEN_DB
120 #define SQL_RDM_STMT_DBUNION SQL_DIAG_RDM_OPEN_DBUNION
121 #define SQL_RDM_STMT_CLOSE SQL_DIAG_RDM_CLOSE_DB
122 #define SQL_RDM_STMT_SELECT SQL_DIAG_RDM_SELECT
123 #define SQL_RDM_STMT_INSERT SQL_DIAG_INSERT
124 #define SQL_RDM_STMT_UPDATE SQL_DIAG_UPDATE_WHERE
125 #define SQL_RDM_STMT_DELETE SQL_DIAG_DELETE_WHERE
126 #define SQL_RDM_STMT_START SQL_DIAG_RDM_START
127 #define SQL_RDM_STMT_COMMIT SQL_DIAG_RDM_COMMIT
128 #define SQL_RDM_STMT_SAVEPOINT SQL_DIAG_RDM_SAVEPOINT
129 #define SQL_RDM_STMT_RELEASE SQL_DIAG_RDM_RELEASE
130 #define SQL_RDM_STMT_ROLLBACK SQL_DIAG_RDM_ROLLBACK
131 #define SQL_RDM_STMT_CRPROC SQL_DIAG_RDM_CREATE_PROCEDURE
132 #define SQL_RDM_STMT_DRPROC SQL_DIAG_RDM_DROP_PROCEDURE
133 #define SQL_RDM_STMT_EXECUTE SQL_DIAG_RDM_EXECUTE_PROCEDURE
134 #define SQL_RDM_STMT_SET SQL_DIAG_RDM_SET
135 #define SQL_RDM_STMT_SETCOLUMN SQL_DIAG_RDM_SET_COLUMN
136 #define SQL_RDM_STMT_LOCK SQL_DIAG_RDM_LOCK
137 #define SQL_RDM_STMT_UNLOCK SQL_DIAG_RDM_UNLOCK
138 #define SQL_RDM_STMT_INITDB SQL_DIAG_RDM_INITIALIZE_SCHEMA
139 #define SQL_RDM_STMT_CRCAT SQL_DIAG_RDM_CREATE_CATALOG
140 #define SQL_RDM_STMT_IMPORT SQL_DIAG_RDM_IMPORT_TABLE
141 #define SQL_RDM_STMT_EXPORT SQL_DIAG_RDM_EXPORT_TABLE
142 #define SQL_RDM_STMT_DDL SQL_DIAG_CREATE_SCHEMA
143 
144 /* ------------------------------------------------------------------------
145  RDM specific error callback function definition
146 */
147 typedef int32_t (SQL_API_PTR ECALLBACK)(int16_t, SQLHANDLE, SQLRETURN, const void *);
148 
149 /* ------------------------------------------------------------------------
150  RDM specific ODBC extension APIs
151 */
155 RDBC_EXPORT SQLRETURN SQL_API SQLDescribeStmt (
156  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
157  SQLUSMALLINT *pStmtType /* OUT: statement type */
158  )
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 
174 #if !defined(RDM_NO_UNICODE)
175 RDBC_EXPORT SQLRETURN SQL_API SQLExtendedTranW (
176  SQLSMALLINT HandleType, /* IN: handle type */
177  SQLHANDLE Handle, /* IN: \RDBC handle */
178  SQLSMALLINT OperationType, /* IN: transaction type indicator */
179  SQLSMALLINT TransactionType, /* IN: \RDBC transaction type */
180  const SQLWCHAR *TransactionID, /* IN: transaction ID (can be NULL) */
181  SQLSMALLINT StringLengthPtr /* IN: length of transaction ID */
182  )
183 ;
184 #endif
185 
190  SQLHSTMT StatementHandle,
191  SQLUSMALLINT *pStmtType
192  )
193 ;
194 
198 RDBC_EXPORT SQLRETURN SQL_API SQLRowId (
199  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
200  const SQLCHAR *TableName, /* IN: Name of the table */
201  SQLROWID *pRowid /* OUT: retrieved ROWID value */
202  )
203 ;
204 
205 #if !defined(RDM_NO_UNICODE)
206 RDBC_EXPORT SQLRETURN SQL_API SQLRowIdW (
207  SQLHSTMT StatementHandle, /* IN: ODBC statement handle */
208  const SQLWCHAR *TableName, /* IN: Name of the table */
209  SQLROWID *pRowid /* OUT: retrieved ROWID value */
210  )
211 ;
212 #endif
213 
217 RDBC_EXPORT SQLRETURN SQL_API SQLSetError (
218  SQLSMALLINT HandleType, /* IN: handle type */
219  SQLHANDLE Handle, /* IN: ODBC handle */
220  SQLRETURN ErrorCode, /* IN: ODBC stat code */
221  ECALLBACK ErrorHandler /* IN: ptr to the user error function */
222  )
223 ;
224 
228 RDBC_EXPORT SQLRETURN SQL_API SQLSetErrorEx (
229  SQLSMALLINT HandleType, /* IN: handle type */
230  SQLHANDLE Handle, /* IN: ODBC handle */
231  SQLRETURN ErrorCode, /* IN: ODBC stat code */
232  ECALLBACK ErrorHandler, /* IN: ptr to the user error function */
233  void *pCtx /* IN: user error context */
234  )
235 ;
236 
240 RDBC_EXPORT SQLRETURN SQL_API SQLShowPlan (
241  SQLHSTMT StatementHandle, /* IN: ODBC statement handle for plan */
242  SQLHSTMT QueryHandle /* IN: ODBC statement handle for query */
243  )
244 ;
245 
249 RDBC_EXPORT SQLRETURN SQL_API SQLTransactStatus (
250  SQLSMALLINT HandleType, /* IN: handle type */
251  SQLHANDLE Handle, /* IN: ODBC handle */
252  SQLSMALLINT *pActive /* OUT: TRUE if tranaction is active */
253  )
254 ;
255 
256 #define SQLExtendedTranA SQLExtendedTran
257 #define SQLRowIdA SQLRowId
258 
259 #if !defined(SQL_NOUNICODEMAP) /* define this to disable the mapping */
260 #if defined(_UNICODE)
261 #define SQLExtendedTran SQLExtendedTranW
262 #define SQLRowId SQLRowIdW
263 #endif
264 #endif
265 
266 
267 #endif /* SQLREXT_H_INCLUDED_ */
268 
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:72
int32_t(* ECALLBACK)(int16_t, SQLHANDLE, SQLRETURN, const void *)
Definition: sqlrext.h:147
int16_t SQLRETURN
SQL API Return Codes.
Definition: sqltypes.h:71
uint8_t SQLCHAR
Definition: sqltypes.h:47
const void * SQLHANDLE
Definition: sqltypes.h:93
RDM_ROWID_T SQLROWID
Definition: sqlrtypes.h:49
uint16_t SQLUSMALLINT
Definition: sqltypes.h:49
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:39
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:38
RDBC_EXPORT SQLRETURN SQLDescribeStmt(SQLHSTMT StatementHandle, SQLUSMALLINT *pStmtType)
Obtain the type of the latest executed statement.
int16_t SQLSMALLINT
Definition: sqltypes.h:48