darcs patch: * Implementing bigint support for odbc + mssql
[clsql.git] / db-odbc / odbc-constants.lisp
1  ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: odbc -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:     odbc-constants.lisp
6 ;;;; Purpose:  Constants for UFFI interface to ODBC
7 ;;;; Authors:  Kevin M. Rosenberg and Paul Meurer
8 ;;;;
9 ;;;; $Id$
10 ;;;;
11 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg
12 ;;;; and Copyright (C) Paul Meurer 1999 - 2001. All rights reserved.
13 ;;;;
14 ;;;; CLSQL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
18
19 (in-package #:odbc)
20
21 ;; on SuSE AMD64 9.0, unixODBC is compiled with with SQLLEN being 4 bytes long
22 (defconstant $ODBC-LONG-TYPE :int)
23 (defconstant $ODBC-ULONG-TYPE :unsigned-int)
24 (defconstant $ODBC-BIG-TYPE :long-long)
25
26 ;; (defconstant $ODBCVER        #x0210)
27
28
29 ;; for new SQLAllocHandle functiion
30 (defconstant $SQL_HANDLE_ENV 1)
31 (defconstant $SQL_HANDLE_DBC 2)
32 (defconstant $SQL_HANDLE_STMT 3)
33 (defconstant $SQL_HANDLE_DESC 4)
34
35 ;; generally useful constants
36 (defconstant $SQL_SPEC_MAJOR 2)         ;; Major version of specification
37 (defconstant $SQL_SPEC_MINOR 10)        ;; Minor version of specification
38 (defvar $SQL_SPEC_STRING        "02.10") ;; String constant for version
39 (defconstant $SQL_SQLSTATE_SIZE 5)              ;; size of SQLSTATE
40 (defconstant $SQL_MAX_MESSAGE_LENGTH 512)       ;; message buffer size
41 (defconstant $SQL_MAX_DSN_LENGTH 32)            ;; maximum data source name size
42
43 ;; RETCODEs
44 (defconstant $SQL_INVALID_HANDLE -2)
45 (defconstant $SQL_ERROR -1)
46 (defconstant $SQL_SUCCESS 0)
47 (defconstant $SQL_SUCCESS_WITH_INFO 1)
48 (defconstant $SQL_NO_DATA_FOUND 100)
49
50 ;; Standard SQL datatypes, using ANSI type numbering
51 (defconstant $SQL_CHAR 1)
52 (defconstant $SQL_NUMERIC 2)
53 (defconstant $SQL_DECIMAL 3)
54 (defconstant $SQL_INTEGER 4)
55 (defconstant $SQL_SMALLINT 5)
56 (defconstant $SQL_FLOAT 6)
57 (defconstant $SQL_REAL 7)
58 (defconstant $SQL_DOUBLE 8)
59 (defconstant $SQL_VARCHAR 12)
60
61 (defconstant $SQL_TYPE_MIN $SQL_CHAR)
62 (defconstant $SQL_TYPE_NULL 0)
63 (defconstant $SQL_TYPE_MAX $SQL_VARCHAR)
64
65 ;; C datatype to SQL datatype mapping   SQL types
66
67 (defconstant $SQL_C_CHAR $SQL_CHAR)             ;; CHAR, VARCHAR, DECIMAL, NUMERIC
68 (defconstant $SQL_C_LONG $SQL_INTEGER)          ;; INTEGER
69 (defconstant $SQL_C_SHORT $SQL_SMALLINT)        ;; SMALLINT
70 (defconstant $SQL_C_FLOAT $SQL_REAL)            ;; REAL
71 (defconstant $SQL_C_DOUBLE $SQL_DOUBLE)         ;; FLOAT, DOUBLE
72 (defconstant $SQL_C_DEFAULT 99)
73
74 ;; NULL status constants.  These are used in SQLColumns, SQLColAttributes,
75 ;;SQLDescribeCol, SQLDescribeParam, and SQLSpecialColumns to describe the
76 ;;nullablity of a column in a table.
77
78 (defconstant $SQL_NO_NULLS 0)
79 (defconstant $SQL_NULLABLE 1)
80 (defconstant $SQL_NULLABLE_UNKNOWN 2)
81
82 ;; Special length values
83 (defconstant $SQL_NULL_DATA -1)
84 (defconstant $SQL_DATA_AT_EXEC -2)
85 (defconstant $SQL_NTS -3)
86
87 ;; SQLFreeStmt defines
88 (defconstant $SQL_CLOSE 0)
89 (defconstant $SQL_DROP 1)
90 (defconstant $SQL_UNBIND 2)
91 (defconstant $SQL_RESET_PARAMS 3)
92
93 ;; SQLTransact defines
94 (defconstant $SQL_COMMIT 0)
95 (defconstant $SQL_ROLLBACK 1)
96
97 ;; SQLColAttributes defines
98 (defconstant $SQL_COLUMN_COUNT 0)
99 (defconstant $SQL_COLUMN_NAME 1)
100 (defconstant $SQL_COLUMN_TYPE 2)
101 (defconstant $SQL_COLUMN_LENGTH 3)
102 (defconstant $SQL_COLUMN_PRECISION 4)
103 (defconstant $SQL_COLUMN_SCALE 5)
104 (defconstant $SQL_COLUMN_DISPLAY_SIZE 6)
105 (defconstant $SQL_COLUMN_NULLABLE 7)
106 (defconstant $SQL_COLUMN_UNSIGNED 8)
107 (defconstant $SQL_COLUMN_MONEY 9)
108 (defconstant $SQL_COLUMN_UPDATABLE 10)
109 (defconstant $SQL_COLUMN_AUTO_INCREMENT 11)
110 (defconstant $SQL_COLUMN_CASE_SENSITIVE 12)
111 (defconstant $SQL_COLUMN_SEARCHABLE 13)
112 (defconstant $SQL_COLUMN_TYPE_NAME 14)
113 (defconstant $SQL_COLUMN_TABLE_NAME 15)
114 (defconstant $SQL_COLUMN_OWNER_NAME 16)
115 (defconstant $SQL_COLUMN_QUALIFIER_NAME 17)
116 (defconstant $SQL_COLUMN_LABEL 18)
117 (defconstant $SQL_COLATT_OPT_MAX $SQL_COLUMN_LABEL)
118
119 (defconstant $SQL_COLUMN_DRIVER_START 1000)
120
121 (defconstant $SQL_COLATT_OPT_MIN $SQL_COLUMN_COUNT)
122
123 ;; SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE
124 (defconstant $SQL_ATTR_READONLY 0)
125 (defconstant $SQL_ATTR_WRITE 1)
126 (defconstant $SQL_ATTR_READWRITE_UNKNOWN 2)
127
128 ;; SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE
129 ;; These are also used by SQLGetInfo
130 (defconstant $SQL_UNSEARCHABLE 0)
131 (defconstant $SQL_LIKE_ONLY 1)
132 (defconstant $SQL_ALL_EXCEPT_LIKE 2)
133 (defconstant $SQL_SEARCHABLE 3)
134
135 ;; SQLError defines
136 (defconstant $SQL_NULL_HENV 0)
137 (defconstant $SQL_NULL_HDBC 0)
138 (defconstant $SQL_NULL_HSTMT 0)
139
140 ;; Defines for SQLGetFunctions
141 ;; Core Functions
142 ;;
143 (defconstant $SQL_API_SQLALLOCCONNECT      1)
144 (defconstant $SQL_API_SQLALLOCENV          2)
145 (defconstant $SQL_API_SQLALLOCSTMT         3)
146 (defconstant $SQL_API_SQLBINDCOL           4)
147 (defconstant $SQL_API_SQLCANCEL            5)
148 (defconstant $SQL_API_SQLCOLATTRIBUTES     6)
149 (defconstant $SQL_API_SQLCONNECT           7)
150 (defconstant $SQL_API_SQLDESCRIBECOL       8)
151 (defconstant $SQL_API_SQLDISCONNECT        9)
152 (defconstant $SQL_API_SQLERROR            10)
153 (defconstant $SQL_API_SQLEXECDIRECT       11)
154 (defconstant $SQL_API_SQLEXECUTE          12)
155 (defconstant $SQL_API_SQLFETCH            13)
156 (defconstant $SQL_API_SQLFREECONNECT      14)
157 (defconstant $SQL_API_SQLFREEENV          15)
158 (defconstant $SQL_API_SQLFREESTMT         16)
159 (defconstant $SQL_API_SQLGETCURSORNAME    17)
160 (defconstant $SQL_API_SQLNUMRESULTCOLS    18)
161 (defconstant $SQL_API_SQLPREPARE          19)
162 (defconstant $SQL_API_SQLROWCOUNT         20)
163 (defconstant $SQL_API_SQLSETCURSORNAME    21)
164 (defconstant $SQL_API_SQLSETPARAM         22)
165 (defconstant $SQL_API_SQLTRANSACT         23)
166 (defconstant $SQL_NUM_FUNCTIONS           23)
167 (defconstant $SQL_EXT_API_START           40)
168
169 ;; Level 1 Functions
170
171 (defconstant $SQL_API_SQLCOLUMNS          40)
172 (defconstant $SQL_API_SQLDRIVERCONNECT    41)
173 (defconstant $SQL_API_SQLGETCONNECTOPTION 42)
174 (defconstant $SQL_API_SQLGETDATA          43)
175 (defconstant $SQL_API_SQLGETFUNCTIONS     44)
176 (defconstant $SQL_API_SQLGETINFO          45)
177 (defconstant $SQL_API_SQLGETSTMTOPTION    46)
178 (defconstant $SQL_API_SQLGETTYPEINFO      47)
179 (defconstant $SQL_API_SQLPARAMDATA        48)
180 (defconstant $SQL_API_SQLPUTDATA          49)
181 (defconstant $SQL_API_SQLSETCONNECTOPTION 50)
182 (defconstant $SQL_API_SQLSETSTMTOPTION    51)
183 (defconstant $SQL_API_SQLSPECIALCOLUMNS   52)
184 (defconstant $SQL_API_SQLSTATISTICS       53)
185 (defconstant $SQL_API_SQLTABLES           54)
186
187 ;; Level 2 Functions
188
189 (defconstant $SQL_API_SQLBROWSECONNECT    55)
190 (defconstant $SQL_API_SQLCOLUMNPRIVILEGES 56)
191 (defconstant $SQL_API_SQLDATASOURCES      57)
192 (defconstant $SQL_API_SQLDESCRIBEPARAM    58)
193 (defconstant $SQL_API_SQLEXTENDEDFETCH    59)
194 (defconstant $SQL_API_SQLFOREIGNKEYS      60)
195 (defconstant $SQL_API_SQLMORERESULTS      61)
196 (defconstant $SQL_API_SQLNATIVESQL        62)
197 (defconstant $SQL_API_SQLNUMPARAMS        63)
198 (defconstant $SQL_API_SQLPARAMOPTIONS     64)
199 (defconstant $SQL_API_SQLPRIMARYKEYS      65)
200 (defconstant $SQL_API_SQLPROCEDURECOLUMNS 66)
201 (defconstant $SQL_API_SQLPROCEDURES       67)
202 (defconstant $SQL_API_SQLSETPOS           68)
203 (defconstant $SQL_API_SQLSETSCROLLOPTIONS 69)
204 (defconstant $SQL_API_SQLTABLEPRIVILEGES  70)
205
206 ;/*             SDK 2.0 Additions               */
207 (defconstant $SQL_API_SQLDRIVERS 71)
208 (defconstant $SQL_API_SQLBINDPARAMETER  72)
209 (defconstant $SQL_EXT_API_LAST $SQL_API_SQLBINDPARAMETER)
210
211 (defconstant $SQL_API_ALL_FUNCTIONS 0)
212
213 (defconstant $SQL_NUM_EXTENSIONS (- $SQL_EXT_API_LAST $SQL_EXT_API_START -1))
214 (defconstant $SQL_API_LOADBYORDINAL 199)
215
216 ;;; Defines for SQLGetInfo
217 (defconstant $SQL_INFO_FIRST                       0)
218 (defconstant $SQL_ACTIVE_CONNECTIONS               0)
219 (defconstant $SQL_ACTIVE_STATEMENTS                1)
220 (defconstant $SQL_DATA_SOURCE_NAME                 2)
221 (defconstant $SQL_DRIVER_HDBC                      3)
222 (defconstant $SQL_DRIVER_HENV                      4)
223 (defconstant $SQL_DRIVER_HSTMT                     5)
224 (defconstant $SQL_DRIVER_NAME                      6)
225 (defconstant $SQL_DRIVER_VER                       7)
226 (defconstant $SQL_FETCH_DIRECTION                  8)
227 (defconstant $SQL_ODBC_API_CONFORMANCE             9)
228 (defconstant $SQL_ODBC_VER                        10)
229 (defconstant $SQL_ROW_UPDATES                     11)
230 (defconstant $SQL_ODBC_SAG_CLI_CONFORMANCE        12)
231 (defconstant $SQL_SERVER_NAME                     13)
232 (defconstant $SQL_SEARCH_PATTERN_ESCAPE           14)
233 (defconstant $SQL_ODBC_SQL_CONFORMANCE            15)
234
235 (defconstant $SQL_DBMS_NAME                       17)
236 (defconstant $SQL_DBMS_VER                        18)
237
238 (defconstant $SQL_ACCESSIBLE_TABLES               19)
239 (defconstant $SQL_ACCESSIBLE_PROCEDURES           20)
240 (defconstant $SQL_PROCEDURES                      21)
241 (defconstant $SQL_CONCAT_NULL_BEHAVIOR            22)
242 (defconstant $SQL_CURSOR_COMMIT_BEHAVIOR          23)
243 (defconstant $SQL_CURSOR_ROLLBACK_BEHAVIOR        24)
244 (defconstant $SQL_DATA_SOURCE_READ_ONLY           25)
245 (defconstant $SQL_DEFAULT_TXN_ISOLATION           26)
246 (defconstant $SQL_EXPRESSIONS_IN_ORDERBY          27)
247 (defconstant $SQL_IDENTIFIER_CASE                 28)
248 (defconstant $SQL_IDENTIFIER_QUOTE_CHAR           29)
249 (defconstant $SQL_MAX_COLUMN_NAME_LEN             30)
250 (defconstant $SQL_MAX_CURSOR_NAME_LEN             31)
251 (defconstant $SQL_MAX_OWNER_NAME_LEN              32)
252 (defconstant $SQL_MAX_PROCEDURE_NAME_LEN          33)
253 (defconstant $SQL_MAX_QUALIFIER_NAME_LEN          34)
254 (defconstant $SQL_MAX_TABLE_NAME_LEN              35)
255 (defconstant $SQL_MULT_RESULT_SETS                36)
256 (defconstant $SQL_MULTIPLE_ACTIVE_TXN             37)
257 (defconstant $SQL_OUTER_JOINS                     38)
258 (defconstant $SQL_OWNER_TERM                      39)
259 (defconstant $SQL_PROCEDURE_TERM                  40)
260 (defconstant $SQL_QUALIFIER_NAME_SEPARATOR        41)
261 (defconstant $SQL_QUALIFIER_TERM                  42)
262 (defconstant $SQL_SCROLL_CONCURRENCY              43)
263 (defconstant $SQL_SCROLL_OPTIONS                  44)
264 (defconstant $SQL_TABLE_TERM                      45)
265 (defconstant $SQL_TXN_CAPABLE                     46)
266 (defconstant $SQL_USER_NAME                       47)
267
268 (defconstant $SQL_CONVERT_FUNCTIONS               48)
269 (defconstant $SQL_NUMERIC_FUNCTIONS               49)
270 (defconstant $SQL_STRING_FUNCTIONS                50)
271 (defconstant $SQL_SYSTEM_FUNCTIONS                51)
272 (defconstant $SQL_TIMEDATE_FUNCTIONS              52)
273
274 (defconstant $SQL_CONVERT_BIGINT                  53)
275 (defconstant $SQL_CONVERT_BINARY                  54)
276 (defconstant $SQL_CONVERT_BIT                     55)
277 (defconstant $SQL_CONVERT_CHAR                    56)
278 (defconstant $SQL_CONVERT_DATE                    57)
279 (defconstant $SQL_CONVERT_DECIMAL                 58)
280 (defconstant $SQL_CONVERT_DOUBLE                  59)
281 (defconstant $SQL_CONVERT_FLOAT                   60)
282 (defconstant $SQL_CONVERT_INTEGER                 61)
283 (defconstant $SQL_CONVERT_LONGVARCHAR             62)
284 (defconstant $SQL_CONVERT_NUMERIC                 63)
285 (defconstant $SQL_CONVERT_REAL                    64)
286 (defconstant $SQL_CONVERT_SMALLINT                65)
287 (defconstant $SQL_CONVERT_TIME                    66)
288 (defconstant $SQL_CONVERT_TIMESTAMP               67)
289 (defconstant $SQL_CONVERT_TINYINT                 68)
290 (defconstant $SQL_CONVERT_VARBINARY               69)
291 (defconstant $SQL_CONVERT_VARCHAR                 70)
292 (defconstant $SQL_CONVERT_LONGVARBINARY           71)
293
294 (defconstant $SQL_TXN_ISOLATION_OPTION            72)
295 (defconstant $SQL_ODBC_SQL_OPT_IEF                73)
296
297 ;;; ODBC SDK 1.0 Additions
298 (defconstant $SQL_CORRELATION_NAME 74)
299 (defconstant $SQL_NON_NULLABLE_COLUMNS 75)
300
301 ;;; ODBC SDK 2.0 Additions
302 (defconstant $SQL_DRIVER_HLIB                   76)
303 (defconstant $SQL_DRIVER_ODBC_VER               77)
304 (defconstant $SQL_LOCK_TYPES                    78)
305 (defconstant $SQL_POS_OPERATIONS                79)
306 (defconstant $SQL_POSITIONED_STATEMENTS         80)
307 (defconstant $SQL_GETDATA_EXTENSIONS            81)
308 (defconstant $SQL_BOOKMARK_PERSISTENCE          82)
309 (defconstant $SQL_STATIC_SENSITIVITY            83)
310 (defconstant $SQL_FILE_USAGE                    84)
311 (defconstant $SQL_NULL_COLLATION                85)
312 (defconstant $SQL_ALTER_TABLE                   86)
313 (defconstant $SQL_COLUMN_ALIAS                  87)
314 (defconstant $SQL_GROUP_BY                      88)
315 (defconstant $SQL_KEYWORDS                      89)
316 (defconstant $SQL_ORDER_BY_COLUMNS_IN_SELECT    90)
317 (defconstant $SQL_OWNER_USAGE                   91)
318 (defconstant $SQL_QUALIFIER_USAGE               92)
319 (defconstant $SQL_QUOTED_IDENTIFIER_CASE        93)
320 (defconstant $SQL_SPECIAL_CHARACTERS            94)
321 (defconstant $SQL_SUBQUERIES                    95)
322 (defconstant $SQL_UNION                         96)
323 (defconstant $SQL_MAX_COLUMNS_IN_GROUP_BY       97)
324 (defconstant $SQL_MAX_COLUMNS_IN_INDEX          98)
325 (defconstant $SQL_MAX_COLUMNS_IN_ORDER_BY       99)
326 (defconstant $SQL_MAX_COLUMNS_IN_SELECT        100)
327 (defconstant $SQL_MAX_COLUMNS_IN_TABLE             101)
328 (defconstant $SQL_MAX_INDEX_SIZE                                   102)
329 (defconstant $SQL_MAX_ROW_SIZE_INCLUDES_LONG       103)
330 (defconstant $SQL_MAX_ROW_SIZE                             104)
331 (defconstant $SQL_MAX_STATEMENT_LEN                        105)
332 (defconstant $SQL_MAX_TABLES_IN_SELECT 106)
333 (defconstant $SQL_MAX_USER_NAME_LEN 107)
334 (defconstant $SQL_MAX_CHAR_LITERAL_LEN 108)
335 (defconstant $SQL_TIMEDATE_ADD_INTERVALS 109)
336 (defconstant $SQL_TIMEDATE_DIFF_INTERVALS          110)
337 (defconstant $SQL_NEED_LONG_DATA_LEN 111)
338 (defconstant $SQL_MAX_BINARY_LITERAL_LEN                   112)
339 (defconstant $SQL_LIKE_ESCAPE_CLAUSE                       113)
340 (defconstant $SQL_QUALIFIER_LOCATION                       114)
341 (defconstant $SQL_ACTIVE_ENVIRONMENTS 116)
342
343 #|
344
345 /*** ODBC SDK 2.01 Additions ***/)
346 (defconstant $SQL_OJ_CAPABILITIES                        65003  ;; Temp value until ODBC 3.0
347
348 (defconstant $SQL_INFO_LAST                                             SQL_QUALIFIER_LOCATION
349 )
350 (defconstant $SQL_INFO_DRIVER_START             1000
351
352 ;; SQL_CONVERT_*  return value bitmasks
353 )
354 (defconstant $SQL_CVT_CHAR                              #x00000001L)
355 (defconstant $SQL_CVT_NUMERIC                   #x00000002L)
356 (defconstant $SQL_CVT_DECIMAL                   #x00000004L)
357 (defconstant $SQL_CVT_INTEGER                   #x00000008L)
358 (defconstant $SQL_CVT_SMALLINT                  #x00000010L)
359 (defconstant $SQL_CVT_FLOAT                             #x00000020L)
360 (defconstant $SQL_CVT_REAL                              #x00000040L)
361 (defconstant $SQL_CVT_DOUBLE                            #x00000080L)
362 (defconstant $SQL_CVT_VARCHAR                   #x00000100L)
363 (defconstant $SQL_CVT_LONGVARCHAR               #x00000200L)
364 (defconstant $SQL_CVT_BINARY                            #x00000400L)
365 (defconstant $SQL_CVT_VARBINARY                 #x00000800L)
366 (defconstant $SQL_CVT_BIT                               #x00001000L)
367 (defconstant $SQL_CVT_TINYINT                   #x00002000L)
368 (defconstant $SQL_CVT_BIGINT                            #x00004000L)
369 (defconstant $SQL_CVT_DATE                              #x00008000L)
370 (defconstant $SQL_CVT_TIME                              #x00010000L)
371 (defconstant $SQL_CVT_TIMESTAMP                 #x00020000L)
372 (defconstant $SQL_CVT_LONGVARBINARY             #x00040000L)
373
374 ;; SQL_CONVERT_FUNCTIONS functions)
375 (defconstant $SQL_FN_CVT_CONVERT                        #x00000001L)
376
377 ;; SQL_STRING_FUNCTIONS functions
378
379 (defconstant $SQL_FN_STR_CONCAT                 #x00000001L)
380 (defconstant $SQL_FN_STR_INSERT                 #x00000002L)
381 (defconstant $SQL_FN_STR_LEFT                   #x00000004L)
382 (defconstant $SQL_FN_STR_LTRIM                  #x00000008L)
383 (defconstant $SQL_FN_STR_LENGTH                 #x00000010L)
384 (defconstant $SQL_FN_STR_LOCATE                 #x00000020L)
385 (defconstant $SQL_FN_STR_LCASE                  #x00000040L)
386 (defconstant $SQL_FN_STR_REPEAT                 #x00000080L)
387 (defconstant $SQL_FN_STR_REPLACE                        #x00000100L)
388 (defconstant $SQL_FN_STR_RIGHT                  #x00000200L)
389 (defconstant $SQL_FN_STR_RTRIM                  #x00000400L)
390 (defconstant $SQL_FN_STR_SUBSTRING              #x00000800L)
391 (defconstant $SQL_FN_STR_UCASE                  #x00001000L)
392 (defconstant $SQL_FN_STR_ASCII                  #x00002000L)
393 (defconstant $SQL_FN_STR_CHAR                   #x00004000L
394 (defconstant $SQL_FN_STR_DIFFERENCE             #x00008000L)
395 (defconstant $SQL_FN_STR_LOCATE_2               #x00010000L)
396 (defconstant $SQL_FN_STR_SOUNDEX                        #x00020000L)
397 (defconstant $SQL_FN_STR_SPACE                  #x00040000L
398
399 ;; SQL_NUMERIC_FUNCTIONS functions
400 )
401 (defconstant $SQL_FN_NUM_ABS                            #x00000001L)
402 (defconstant $SQL_FN_NUM_ACOS                   #x00000002L)
403 (defconstant $SQL_FN_NUM_ASIN                   #x00000004L)
404 (defconstant $SQL_FN_NUM_ATAN                   #x00000008L)
405 (defconstant $SQL_FN_NUM_ATAN2                  #x00000010L)
406 (defconstant $SQL_FN_NUM_CEILING                        #x00000020L)
407 (defconstant $SQL_FN_NUM_COS                            #x00000040L)
408 (defconstant $SQL_FN_NUM_COT                            #x00000080L)
409 (defconstant $SQL_FN_NUM_EXP                            #x00000100L)
410 (defconstant $SQL_FN_NUM_FLOOR                  #x00000200L)
411 (defconstant $SQL_FN_NUM_LOG                            #x00000400L)
412 (defconstant $SQL_FN_NUM_MOD                            #x00000800L)
413 (defconstant $SQL_FN_NUM_SIGN                   #x00001000L)
414 (defconstant $SQL_FN_NUM_SIN                            #x00002000L)
415 (defconstant $SQL_FN_NUM_SQRT                   #x00004000L)
416 (defconstant $SQL_FN_NUM_TAN                            #x00008000L)
417 (defconstant $SQL_FN_NUM_PI                             #x00010000L)
418 (defconstant $SQL_FN_NUM_RAND                   #x00020000L
419 (defconstant $SQL_FN_NUM_DEGREES                        #x00040000L)
420 (defconstant $SQL_FN_NUM_LOG10                  #x00080000L)
421 (defconstant $SQL_FN_NUM_POWER                  #x00100000L)
422 (defconstant $SQL_FN_NUM_RADIANS                        #x00200000L)
423 (defconstant $SQL_FN_NUM_ROUND                  #x00400000L)
424 (defconstant $SQL_FN_NUM_TRUNCATE               #x00800000L
425
426 ;; SQL_TIMEDATE_FUNCTIONS functions
427 )
428 (defconstant $SQL_FN_TD_NOW                             #x00000001L)
429 (defconstant $SQL_FN_TD_CURDATE                 #x00000002L)
430 (defconstant $SQL_FN_TD_DAYOFMONTH              #x00000004L)
431 (defconstant $SQL_FN_TD_DAYOFWEEK               #x00000008L)
432 (defconstant $SQL_FN_TD_DAYOFYEAR               #x00000010L)
433 (defconstant $SQL_FN_TD_MONTH                   #x00000020L)
434 (defconstant $SQL_FN_TD_QUARTER                 #x00000040L)
435 (defconstant $SQL_FN_TD_WEEK                            #x00000080L)
436 (defconstant $SQL_FN_TD_YEAR                            #x00000100L)
437 (defconstant $SQL_FN_TD_CURTIME                 #x00000200L)
438 (defconstant $SQL_FN_TD_HOUR                            #x00000400L)
439 (defconstant $SQL_FN_TD_MINUTE                  #x00000800L)
440 (defconstant $SQL_FN_TD_SECOND                  #x00001000L
441 (defconstant $SQL_FN_TD_TIMESTAMPADD            #x00002000L)
442 (defconstant $SQL_FN_TD_TIMESTAMPDIFF   #x00004000L)
443 (defconstant $SQL_FN_TD_DAYNAME                 #x00008000L)
444 (defconstant $SQL_FN_TD_MONTHNAME               #x00010000L
445
446 ;; SQL_SYSTEM_FUNCTIONS functions
447 )
448 (defconstant $SQL_FN_SYS_USERNAME               #x00000001L)
449 (defconstant $SQL_FN_SYS_DBNAME                 #x00000002L)
450 (defconstant $SQL_FN_SYS_IFNULL                 #x00000004L
451
452 ;; SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions
453
454 (defconstant $SQL_FN_TSI_FRAC_SECOND            #x00000001L)
455 (defconstant $SQL_FN_TSI_SECOND                 #x00000002L)
456 (defconstant $SQL_FN_TSI_MINUTE                 #x00000004L)
457 (defconstant $SQL_FN_TSI_HOUR                   #x00000008L)
458 (defconstant $SQL_FN_TSI_DAY                            #x00000010L)
459 (defconstant $SQL_FN_TSI_WEEK                   #x00000020L)
460 (defconstant $SQL_FN_TSI_MONTH                  #x00000040L)
461 (defconstant $SQL_FN_TSI_QUARTER                        #x00000080L)
462 (defconstant $SQL_FN_TSI_YEAR                   #x00000100L
463
464 ;; SQL_ODBC_API_CONFORMANCE values
465 )
466 (defconstant $SQL_OAC_NONE                              #x0000)
467 (defconstant $SQL_OAC_LEVEL1                            #x0001)
468 (defconstant $SQL_OAC_LEVEL2                            #x0002
469
470 ;; SQL_ODBC_SAG_CLI_CONFORMANCE values
471 )
472 (defconstant $SQL_OSCC_NOT_COMPLIANT            #x0000)
473 (defconstant $SQL_OSCC_COMPLIANT                        #x0001
474
475 ;; SQL_ODBC_SQL_CONFORMANCE values
476 )
477 (defconstant $SQL_OSC_MINIMUM                   #x0000)
478 (defconstant $SQL_OSC_CORE                              #x0001)
479 (defconstant $SQL_OSC_EXTENDED                  #x0002
480
481 ;; SQL_CONCAT_NULL_BEHAVIOR values
482 )
483 (defconstant $SQL_CB_NULL                               #x0000)
484 (defconstant $SQL_CB_NON_NULL                   #x0001
485
486 ;; SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values
487 )
488 (defconstant $SQL_CB_DELETE                             #x0000)
489 (defconstant $SQL_CB_CLOSE                              #x0001)
490 (defconstant $SQL_CB_PRESERVE                           #x0002
491
492 ;; SQL_IDENTIFIER_CASE values
493 )
494 (defconstant $SQL_IC_UPPER                              #x0001)
495 (defconstant $SQL_IC_LOWER                              #x0002)
496 (defconstant $SQL_IC_SENSITIVE                  #x0003)
497 (defconstant $SQL_IC_MIXED                              #x0004
498
499 ;; SQL_TXN_CAPABLE values
500 |#
501
502 (defconstant $SQL_TC_NONE 0)
503 (defconstant $SQL_TC_DML 1)
504 (defconstant $SQL_TC_ALL 2)
505
506 (defconstant $SQL_TC_DDL_COMMIT 3)
507 (defconstant $SQL_TC_DDL_IGNORE 4)
508
509 ;; SQL_SCROLL_OPTIONS masks
510
511
512 (defconstant $SQL_SO_FORWARD_ONLY #x00000001)
513 (defconstant $SQL_SO_KEYSET_DRIVEN #x00000002)
514 (defconstant $SQL_SO_DYNAMIC #x00000004)
515 (defconstant $SQL_SO_MIXED #x00000008)
516 (defconstant $SQL_SO_STATIC #x00000010)
517
518 ;; SQL_SCROLL_CONCURRENCY masks
519
520 (defconstant $SQL_SCCO_READ_ONLY #x00000001)
521 (defconstant $SQL_SCCO_LOCK #x00000002)
522 (defconstant $SQL_SCCO_OPT_ROWVER #x00000004)
523 (defconstant $SQL_SCCO_OPT_VALUES #x00000008)
524
525 ;; SQL_FETCH_DIRECTION masks
526
527 (defconstant $SQL_FD_FETCH_NEXT #x00000001)
528 (defconstant $SQL_FD_FETCH_FIRST #x00000002)
529 (defconstant $SQL_FD_FETCH_LAST #x00000004)
530 (defconstant $SQL_FD_FETCH_PRIOR #x00000008)
531 (defconstant $SQL_FD_FETCH_ABSOLUTE #x00000010)
532 (defconstant $SQL_FD_FETCH_RELATIVE #x00000020)
533 (defconstant $SQL_FD_FETCH_RESUME #x00000040)
534 (defconstant $SQL_FD_FETCH_BOOKMARK #x00000080)
535
536 #|
537 ;; SQL_TXN_ISOLATION_OPTION masks
538 )
539 (defconstant $SQL_TXN_READ_UNCOMMITTED  #x00000001L)
540 (defconstant $SQL_TXN_READ_COMMITTED            #x00000002L)
541 (defconstant $SQL_TXN_REPEATABLE_READ   #x00000004L)
542 (defconstant $SQL_TXN_SERIALIZABLE              #x00000008L)
543 (defconstant $SQL_TXN_VERSIONING                        #x00000010L
544
545 ;; SQL_CORRELATION_NAME values
546 )
547 (defconstant $SQL_CN_NONE                               #x0000)
548 (defconstant $SQL_CN_DIFFERENT                  #x0001)
549 (defconstant $SQL_CN_ANY                                        #x0002
550
551 ;; SQL_NON_NULLABLE_COLUMNS values
552 )
553 (defconstant $SQL_NNC_NULL                              #x0000)
554 (defconstant $SQL_NNC_NON_NULL                  #x0001
555
556 ;; SQL_NULL_COLLATION values
557                                                                           )
558 (defconstant $SQL_NC_HIGH                               #x0000)
559 (defconstant $SQL_NC_LOW                                        #x0001)
560 (defconstant $SQL_NC_START                              #x0002)
561 (defconstant $SQL_NC_END                                        #x0004
562
563 ;; SQL_FILE_USAGE values
564 )
565 (defconstant $SQL_FILE_NOT_SUPPORTED            #x0000)
566 (defconstant $SQL_FILE_TABLE                            #x0001)
567 (defconstant $SQL_FILE_QUALIFIER                        #x0002
568
569 ;; SQL_GETDATA_EXTENSIONS values
570 )
571 (defconstant $SQL_GD_ANY_COLUMN                 #x00000001L)
572 (defconstant $SQL_GD_ANY_ORDER                  #x00000002L)
573 (defconstant $SQL_GD_BLOCK                              #x00000004L)
574 (defconstant $SQL_GD_BOUND                              #x00000008L
575
576 ;; SQL_ALTER_TABLE values
577 )
578 (defconstant $SQL_AT_ADD_COLUMN                 #x00000001L)
579 (defconstant $SQL_AT_DROP_COLUMN                        #x00000002L
580
581 ;; SQL_POSITIONED_STATEMENTS masks
582 )
583 (defconstant $SQL_PS_POSITIONED_DELETE  #x00000001L)
584 (defconstant $SQL_PS_POSITIONED_UPDATE  #x00000002L)
585 (defconstant $SQL_PS_SELECT_FOR_UPDATE  #x00000004L
586
587 ;; SQL_GROUP_BY values
588 )
589 (defconstant $SQL_GB_NOT_SUPPORTED                      #x0000)
590 (defconstant $SQL_GB_GROUP_BY_EQUALS_SELECT     #x0001)
591 (defconstant $SQL_GB_GROUP_BY_CONTAINS_SELECT   #x0002)
592 (defconstant $SQL_GB_NO_RELATION                                #x0003
593
594 ;; SQL_OWNER_USAGE masks
595 )
596 (defconstant $SQL_OU_DML_STATEMENTS             #x00000001L)
597 (defconstant $SQL_OU_PROCEDURE_INVOCATION #x00000002L)
598 (defconstant $SQL_OU_TABLE_DEFINITION   #x00000004L)
599 (defconstant $SQL_OU_INDEX_DEFINITION   #x00000008L)
600 (defconstant $SQL_OU_PRIVILEGE_DEFINITION #x00000010L
601
602 ;; SQL_QUALIFIER_USAGE masks
603 )
604 (defconstant $SQL_QU_DML_STATEMENTS             #x00000001L)
605 (defconstant $SQL_QU_PROCEDURE_INVOCATION #x00000002L)
606 (defconstant $SQL_QU_TABLE_DEFINITION   #x00000004L)
607 (defconstant $SQL_QU_INDEX_DEFINITION   #x00000008L)
608 (defconstant $SQL_QU_PRIVILEGE_DEFINITION #x00000010L
609
610 ;; SQL_SUBQUERIES masks
611 )
612 (defconstant $SQL_SQ_COMPARISON                         #x00000001L)
613 (defconstant $SQL_SQ_EXISTS                                     #x00000002L)
614 (defconstant $SQL_SQ_IN                                         #x00000004L)
615 (defconstant $SQL_SQ_QUANTIFIED                         #x00000008L)
616 (defconstant $SQL_SQ_CORRELATED_SUBQUERIES      #x00000010L
617
618 ;; SQL_UNION masks
619 )
620 (defconstant $SQL_U_UNION                                               #x00000001L)
621 (defconstant $SQL_U_UNION_ALL                                   #x00000002L
622
623 ;; SQL_BOOKMARK_PERSISTENCE values
624 )
625 (defconstant $SQL_BP_CLOSE                              #x00000001L)
626 (defconstant $SQL_BP_DELETE                             #x00000002L)
627 (defconstant $SQL_BP_DROP                               #x00000004L)
628 (defconstant $SQL_BP_TRANSACTION                        #x00000008L)
629 (defconstant $SQL_BP_UPDATE                             #x00000010L)
630 (defconstant $SQL_BP_OTHER_HSTMT                        #x00000020L)
631 (defconstant $SQL_BP_SCROLL                             #x00000040L
632
633 ;; SQL_STATIC_SENSITIVITY values
634 )
635 (defconstant $SQL_SS_ADDITIONS                  #x00000001L)
636 (defconstant $SQL_SS_DELETIONS                  #x00000002L)
637 (defconstant $SQL_SS_UPDATES                            #x00000004L
638
639 ;; SQL_LOCK_TYPESL masks
640 )
641 (defconstant $SQL_LCK_NO_CHANGE                 #x00000001L)
642 (defconstant $SQL_LCK_EXCLUSIVE                 #x00000002L)
643 (defconstant $SQL_LCK_UNLOCK                            #x00000004L
644
645 ;; SQL_POS_OPERATIONS masks
646 |#
647
648 (defconstant $SQL_POS_POSITION 1) ;; #x00000001L
649 (defconstant $SQL_POS_REFRESH 2)  ;; #x00000002L
650 (defconstant $SQL_POS_UPDATE 4)   ;; #x00000004L
651 (defconstant $SQL_POS_DELETE 8)   ;; #x00000008L
652 (defconstant $SQL_POS_ADD 16)     ;; #x00000010L
653
654 #|
655 ;; SQL_QUALIFIER_LOCATION values
656 )
657 (defconstant $SQL_QL_START                              #x0001L)
658 (defconstant $SQL_QL_END                                        #x0002L
659
660 ;; SQL_OJ_CAPABILITIES values
661
662 (defconstant $SQL_OJ_LEFT                                       #x00000001L)
663 (defconstant $SQL_OJ_RIGHT                              #x00000002L)
664 (defconstant $SQL_OJ_FULL                                       #x00000004L)
665 (defconstant $SQL_OJ_NESTED                             #x00000008L)
666 (defconstant $SQL_OJ_NOT_ORDERED                        #x00000010L)
667 (defconstant $SQL_OJ_INNER                              #x00000020L)
668 (defconstant $SQL_OJ_ALL_COMPARISON_OPS #x00000040L
669
670 ;; options for SQLGetStmtOption/SQLSetStmtOption)
671 (defconstant $SQL_QUERY_TIMEOUT                 0)
672 (defconstant $SQL_MAX_ROWS                              1)
673 (defconstant $SQL_NOSCAN                                        2)
674 (defconstant $SQL_MAX_LENGTH                            3)
675 (defconstant $SQL_ASYNC_ENABLE                  4)
676 (defconstant $SQL_BIND_TYPE                             5
677 (defconstant $SQL_CURSOR_TYPE                   6)
678 (defconstant $SQL_CONCURRENCY                   7)
679 (defconstant $SQL_KEYSET_SIZE                   8)
680 (defconstant $SQL_ROWSET_SIZE                   9)
681 (defconstant $SQL_SIMULATE_CURSOR               10)
682 (defconstant $SQL_RETRIEVE_DATA                 11)
683 (defconstant $SQL_USE_BOOKMARKS                 12)
684 (defconstant $SQL_GET_BOOKMARK                  13      /*      GetStmtOption Only)
685 (defconstant $SQL_ROW_NUMBER                            14      /*      GetStmtOption Only)
686 (defconstant $SQL_STMT_OPT_MAX                  SQL_ROW_NUMBER
687 )
688 (defconstant $SQL_STMT_OPT_MIN                  SQL_QUERY_TIMEOUT
689
690
691 ;; SQL_QUERY_TIMEOUT options)
692 (defconstant $SQL_QUERY_TIMEOUT_DEFAULT 0UL
693
694 ;; SQL_MAX_ROWS options)
695 (defconstant $SQL_MAX_ROWS_DEFAULT              0UL
696
697 ;; SQL_NOSCAN options)
698 (defconstant $SQL_NOSCAN_OFF                            0UL     /*      1.0 FALSE)
699 (defconstant $SQL_NOSCAN_ON                             1UL     /*      1.0 TRUE)
700 (defconstant $SQL_NOSCAN_DEFAULT                        SQL_NOSCAN_OFF
701
702 ;; SQL_MAX_LENGTH options)
703 (defconstant $SQL_MAX_LENGTH_DEFAULT            0UL
704
705 ;; SQL_ASYNC_ENABLE options)
706 (defconstant $SQL_ASYNC_ENABLE_OFF              0UL)
707 (defconstant $SQL_ASYNC_ENABLE_ON                       1UL)
708 (defconstant $SQL_ASYNC_ENABLE_DEFAULT  SQL_ASYNC_ENABLE_OFF
709
710 ;; SQL_BIND_TYPE options)
711 (defconstant $SQL_BIND_BY_COLUMN                        0UL)
712 (defconstant $SQL_BIND_TYPE_DEFAULT             SQL_BIND_BY_COLUMN              ;; Default value
713
714 ;; SQL_CONCURRENCY options)
715 (defconstant $SQL_CONCUR_READ_ONLY              1)
716 (defconstant $SQL_CONCUR_LOCK                   2)
717 (defconstant $SQL_CONCUR_ROWVER                 3)
718 (defconstant $SQL_CONCUR_VALUES                 4)
719 (defconstant $SQL_CONCUR_DEFAULT                        SQL_CONCUR_READ_ONLY    ;; Default value
720
721 ;; SQL_CURSOR_TYPE options)
722 (defconstant $SQL_CURSOR_FORWARD_ONLY   0UL)
723 (defconstant $SQL_CURSOR_KEYSET_DRIVEN  1UL)
724 (defconstant $SQL_CURSOR_DYNAMIC                        2UL)
725 (defconstant $SQL_CURSOR_STATIC                 3UL)
726 (defconstant $SQL_CURSOR_TYPE_DEFAULT           SQL_CURSOR_FORWARD_ONLY ;; Default value
727
728 ;; SQL_ROWSET_SIZE options)
729 (defconstant $SQL_ROWSET_SIZE_DEFAULT   1UL
730
731 ;; SQL_KEYSET_SIZE options)
732 (defconstant $SQL_KEYSET_SIZE_DEFAULT           0UL
733
734 ;; SQL_SIMULATE_CURSOR options)
735 (defconstant $SQL_SC_NON_UNIQUE                 0UL)
736 (defconstant $SQL_SC_TRY_UNIQUE                 1UL)
737 (defconstant $SQL_SC_UNIQUE                             2UL
738
739 ;; SQL_RETRIEVE_DATA options)
740 (defconstant $SQL_RD_OFF                                        0UL)
741 (defconstant $SQL_RD_ON                                 1UL)
742 (defconstant $SQL_RD_DEFAULT                            SQL_RD_ON
743
744 ;; SQL_USE_BOOKMARKS options)
745 (defconstant $SQL_UB_OFF                                        0UL)
746 (defconstant $SQL_UB_ON                                 1UL)
747 (defconstant $SQL_UB_DEFAULT                            SQL_UB_OFF
748
749
750 |#
751
752 ;; options for SQLSetConnectOption/SQLGetConnectOption)
753 (defconstant $SQL_ACCESS_MODE 101)
754 (defconstant $SQL_AUTOCOMMIT 102)
755 (defconstant $SQL_LOGIN_TIMEOUT 103)
756 (defconstant $SQL_OPT_TRACE 104)
757 (defconstant $SQL_OPT_TRACEFILE 105)
758 (defconstant $SQL_TRANSLATE_DLL 106)
759 (defconstant $SQL_TRANSLATE_OPTION 107)
760 (defconstant $SQL_TXN_ISOLATION 108)
761 (defconstant $SQL_CURRENT_QUALIFIER 109)
762 (defconstant $SQL_ODBC_CURSORS 110)
763 (defconstant $SQL_QUIET_MODE 111)
764 (defconstant $SQL_PACKET_SIZE 112)
765 (defconstant $SQL_CONN_OPT_MAX $SQL_PACKET_SIZE)
766 (defconstant $SQL_CONNECT_OPT_DRVR_START 1000)
767
768 ;;#define       SQL_CONN_OPT_MIN                        SQL_ACCESS_MODE
769
770 ;; SQL_ACCESS_MODE options
771 (defconstant $SQL_MODE_READ_WRITE 0) ; 0UL
772 (defconstant $SQL_MODE_READ_ONLY 1)  ; 1UL
773 (defconstant $SQL_MODE_DEFAULT $SQL_MODE_READ_WRITE)
774
775 ;; SQL_AUTOCOMMIT options)
776 (defconstant $SQL_AUTOCOMMIT_OFF 0) ;0UL
777 (defconstant $SQL_AUTOCOMMIT_ON 1) ;1UL
778 (defconstant $SQL_AUTOCOMMIT_DEFAULT $SQL_AUTOCOMMIT_ON)
779
780 ;; SQL_LOGIN_TIMEOUT options)
781 (defconstant $SQL_LOGIN_TIMEOUT_DEFAULT 15) ; 15UL
782
783 ;; SQL_OPT_TRACE options)
784 (defconstant $SQL_OPT_TRACE_OFF 0) ; 0UL
785 (defconstant $SQL_OPT_TRACE_ON 1) ; 1UL
786 (defconstant $SQL_OPT_TRACE_DEFAULT $SQL_OPT_TRACE_OFF)
787 ; #ifndef SQL_OPT_TRACE_FILE_DEFAULT
788 ; (defconstant $SQL_OPT_TRACE_FILE_DEFAULT      "\\SQL.LOG"
789 ;; #endif
790
791 (defconstant $SQL_CUR_USE_IF_NEEDED 0) ; 0UL
792 (defconstant $SQL_CUR_USE_ODBC 1) ; 1UL
793 (defconstant $SQL_CUR_USE_DRIVER 2) ; 2UL
794 (defconstant $SQL_CUR_DEFAULT $SQL_CUR_USE_DRIVER)
795
796 #|
797 ;; Column types and scopes in SQLSpecialColumns. )
798 (defconstant $SQL_BEST_ROWID 1)
799 (defconstant $SQL_ROWVER 2)
800 )
801 (defconstant $SQL_SCOPE_CURROW                  0)
802 (defconstant $SQL_SCOPE_TRANSACTION             1)
803 (defconstant $SQL_SCOPE_SESSION                 2
804
805 ;; Defines for SQLSetPos)
806 (defconstant $SQL_ENTIRE_ROWSET                 0
807 |#
808
809 ;; Operations in SQLSetPos
810
811 (defconstant $SQL_POSITION 0) ;; 1.0 FALSE
812 (defconstant $SQL_REFRESH 1)  ;; 1.0 TRUE
813 (defconstant $SQL_UPDATE 2)
814 (defconstant $SQL_DELETE 3)
815 (defconstant $SQL_ADD 4)
816
817 ;; Lock options in SQLSetPos)
818 (defconstant $SQL_LOCK_NO_CHANGE 0) ;; 1.0 FALSE
819 (defconstant $SQL_LOCK_EXCLUSIVE 1) ;; 1.0 TRUE
820 (defconstant $SQL_LOCK_UNLOCK 2)
821
822 ;; SQLBindParameter extensions
823 (defconstant $SQL_DEFAULT_PARAM -5)
824 (defconstant $SQL_IGNORE -6)
825 (defconstant $SQL_LEN_DATA_AT_EXEC_OFFSET -100)
826 ;(defconstant $SQL_LEN_DATA_AT_EXEC(length) (-length+SQL_LEN_DATA_AT_EXEC_OFFSET)
827
828 ;; Special return values for SQLGetData
829 (defconstant $SQL_NO_TOTAL -4)
830
831 #|
832 ;; Macros for SQLSetPos)
833 (defconstant $SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE))
834 (defconstant $SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock))
835 (defconstant $SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock))
836 (defconstant $SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE))
837 (defconstant $SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE))
838 (defconstant $SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
839
840 ; #ifndef RC_INVOKED
841
842 /*      This define is too large for RC)
843 (defconstant $SQL_ODBC_KEYWORDS \
844 "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
845 "ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\
846 "BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\
847 "CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\
848 "COBOL,COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\
849 "CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\
850 "CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\
851 "DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\
852 "DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\
853 "DISTINCT,DOMAIN,DOUBLE,DROP,"\
854 "ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\
855 "EXISTS,EXTERNAL,EXTRACT,"\
856 "FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\
857 "GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\
858 "IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\
859 "INPUT,INSENSITIVE,INSERT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\
860 "JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\
861 "MATCH,MAX,MIN,MINUTE,MODULE,MONTH,MUMPS,"\
862 "NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\
863 "OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\
864 "PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\
865 "PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\
866 "REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS,"\
867 "SCHEMA,SCROLL,SECOND,SECTION,SELECT,SEQUENCE,SESSION,SESSION_USER,SET,SIZE,"\
868 "SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\
869 "SUBSTRING,SUM,SYSTEM_USER,"\
870 "TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\
871 "TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\
872 "UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
873 "VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR")
874 |#
875
876 (defconstant $SQL_PARAM_TYPE_UNKNOWN 0)
877 (defconstant $SQL_PARAM_INPUT 1)
878 (defconstant $SQL_PARAM_INPUT_OUTPUT 2)
879 (defconstant $SQL_RESULT_COL 3)
880 (defconstant $SQL_PARAM_OUTPUT 4)
881 (defconstant $SQL_RETURN_VALUE 5)
882
883
884 ;; Defines used by both Level 1 and Level 2 functions
885
886 ;; generally useful constants
887 (defconstant $SQL_MAX_OPTION_STRING_LENGTH 256)
888
889 ;; Additional return codes)
890 (defconstant $SQL_STILL_EXECUTING 2)
891 (defconstant $SQL_NEED_DATA 99)
892
893 ;; SQL extended datatypes)
894 (defconstant $SQL_DATE 9)
895 (defconstant $SQL_TIME 10)
896 (defconstant $SQL_TIMESTAMP 11)
897 (defconstant $SQL_LONGVARCHAR -1)
898 (defconstant $SQL_BINARY -2)
899 (defconstant $SQL_VARBINARY -3)
900 (defconstant $SQL_LONGVARBINARY -4)
901 (defconstant $SQL_BIGINT -5)
902 (defconstant $SQL_TINYINT -6)
903 (defconstant $SQL_BIT -7)
904
905 ;; For ODBC3
906 (defconstant $SQL_TYPE_DATE 91)
907 (defconstant $SQL_TYPE_TIME 92)
908 (defconstant $SQL_TYPE_TIMESTAMP 93)
909
910 (defconstant $SQL_INTERVAL_YEAR -80)
911 (defconstant $SQL_INTERVAL_MONTH -81)
912 (defconstant $SQL_INTERVAL_YEAR_TO_MONTH -82)
913 (defconstant $SQL_INTERVAL_DAY -83)
914 (defconstant $SQL_INTERVAL_HOUR -84)
915 (defconstant $SQL_INTERVAL_MINUTE -85)
916 (defconstant $SQL_INTERVAL_SECOND -86)
917 (defconstant $SQL_INTERVAL_DAY_TO_HOUR -87)
918 (defconstant $SQL_INTERVAL_DAY_TO_MINUTE -88)
919 (defconstant $SQL_INTERVAL_DAY_TO_SECOND -89)
920 (defconstant $SQL_INTERVAL_HOUR_TO_MINUTE -90)
921 (defconstant $SQL_INTERVAL_HOUR_TO_SECOND -91)
922 (defconstant $SQL_INTERVAL_MINUTE_TO_SECOND -92)
923 (defconstant $SQL_UNICODE -95)
924 (defconstant $SQL_TYPE_DRIVER_START $SQL_INTERVAL_YEAR)
925 (defconstant $SQL_TYPE_DRIVER_END $SQL_UNICODE)
926
927
928 (defconstant $SQL_SIGNED_OFFSET -20)
929 (defconstant $SQL_UNSIGNED_OFFSET -22)
930
931 ;; C datatype to SQL datatype mapping
932 (defconstant $SQL_C_DATE $SQL_DATE)
933 (defconstant $SQL_C_TIME $SQL_TIME)
934 (defconstant $SQL_C_TIMESTAMP $SQL_TIMESTAMP)
935 (defconstant $SQL_C_BINARY $SQL_BINARY)
936 (defconstant $SQL_C_BIT $SQL_BIT)
937 (defconstant $SQL_C_TINYINT $SQL_TINYINT)
938 (defconstant $SQL_C_SBIGINT (+ $SQL_BIGINT $SQL_SIGNED_OFFSET))
939 (defconstant $SQL_C_SLONG (+ $SQL_C_LONG $SQL_SIGNED_OFFSET)) ;; SIGNED INTEGER
940 (defconstant $SQL_C_SSHORT (+ $SQL_C_SHORT $SQL_SIGNED_OFFSET)) ;; SIGNED SMALLINT
941 (defconstant $SQL_C_STINYINT (+ $SQL_TINYINT $SQL_SIGNED_OFFSET)) ;; SIGNED TINYINT
942 (defconstant $SQL_C_ULONG (+ $SQL_C_LONG $SQL_UNSIGNED_OFFSET)) ;; UNSIGNED INTEGER
943 (defconstant $SQL_C_USHORT (+ $SQL_C_SHORT $SQL_UNSIGNED_OFFSET)) ;; UNSIGNED SMALLINT
944 (defconstant $SQL_C_UTINYINT (+ $SQL_TINYINT $SQL_UNSIGNED_OFFSET)) ;;UNSIGNED TINYINT
945 (defconstant $SQL_C_BOOKMARK $SQL_C_ULONG) ;; BOOKMARK
946
947 ;;; ODBC3
948 (defconstant $SQL_C_TYPE_DATE $SQL_TYPE_DATE)
949 (defconstant $SQL_C_TYPE_TIME $SQL_TYPE_TIME)
950 (defconstant $SQL_C_TYPE_TIMESTAMP $SQL_TYPE_TIMESTAMP)
951
952 ;; Options for SQLDriverConnect
953 (defconstant $SQL_DRIVER_NOPROMPT 0)
954 (defconstant $SQL_DRIVER_COMPLETE 1)
955 (defconstant $SQL_DRIVER_PROMPT 2)
956 (defconstant $SQL_DRIVER_COMPLETE_REQUIRED 3)
957
958 (defconstant $SQL_MAX_CONN_OUT 1024)
959
960 ;; Level 2 Functions
961
962 ;; SQLExtendedFetch "fFetchType" values
963 (defconstant $SQL_FETCH_NEXT 1)
964 (defconstant $SQL_FETCH_FIRST 2)
965 (defconstant $SQL_FETCH_LAST 3)
966 (defconstant $SQL_FETCH_PRIOR 4)
967 (defconstant $SQL_FETCH_ABSOLUTE 5)
968 (defconstant $SQL_FETCH_RELATIVE 6)
969 (defconstant $SQL_FETCH_BOOKMARK 8)
970
971 ;;; ODBC v3 constants, added by KMR
972
973 (defconstant $SQL_ATTR_ODBC_VERSION 200)
974 (defconstant $SQL_OV_ODBC2 2)
975 (defconstant $SQL_OV_ODBC3 3)
976 (defconstant $SQL_INDEX_UNIQUE 0)
977 (defconstant $SQL_INDEX_ALL 1)
978 (defconstant $SQL_QUICK 0)
979 (defconstant $SQL_ENSURE 1)
980
981