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