r11418: 30 Dec 2006 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / db-odbc / odbc-constants.lisp
index 91b09c81f97fc0d9d82748e0aed1e33109fcd010..6d8a1839a8f32ca2bc35e93ca2ce68a611ea30ce 100644 (file)
@@ -1,12 +1,12 @@
-;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: odbc -*-
+ ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: odbc -*-
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
 ;;;; Name:     odbc-constants.lisp
 ;;;; Purpose:  Constants for UFFI interface to ODBC
-;;;; Authors:  Paul Meurer and Kevin M. Rosenberg
+;;;; Authors:  Kevin M. Rosenberg and Paul Meurer
 ;;;;
-;;;; $Id: odbc-package.lisp 7061 2003-09-07 06:34:45Z kevin $
+;;;; $Id$
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg
 ;;;; and Copyright (C) Paul Meurer 1999 - 2001. All rights reserved.
 
 (in-package #:odbc)
 
-(defconstant $ODBCVER  #x0210)
+;; on SuSE AMD64 9.0, unixODBC is compiled with with SQLLEN being 4 bytes long
+(defconstant $ODBC-LONG-TYPE :int)
+(defconstant $ODBC-ULONG-TYPE :unsigned-int)
+
+;; (defconstant $ODBCVER       #x0210)
+
+
+;; for new SQLAllocHandle functiion
+(defconstant $SQL_HANDLE_ENV 1)
+(defconstant $SQL_HANDLE_DBC 2)
+(defconstant $SQL_HANDLE_STMT 3)
+(defconstant $SQL_HANDLE_DESC 4)
 
 ;; generally useful constants
 (defconstant $SQL_SPEC_MAJOR 2)                ;; Major version of specification 
 (defconstant $SQL_SPEC_MINOR 10)       ;; Minor version of specification 
-(defconstant $SQL_SPEC_STRING  "02.10") ;; String constant for version   
+(defvar $SQL_SPEC_STRING       "02.10") ;; String constant for version   
 (defconstant $SQL_SQLSTATE_SIZE 5)             ;; size of SQLSTATE                       
 (defconstant $SQL_MAX_MESSAGE_LENGTH 512)      ;; message buffer size                    
 (defconstant $SQL_MAX_DSN_LENGTH 32)           ;; maximum data source name size  
 (defconstant $SQL_USE_BOOKMARKS                        12)
 (defconstant $SQL_GET_BOOKMARK                 13      /*      GetStmtOption Only)
 (defconstant $SQL_ROW_NUMBER                           14      /*      GetStmtOption Only)
-; #if (ODBCVER >= #x0200))
 (defconstant $SQL_STMT_OPT_MAX                 SQL_ROW_NUMBER
-;; #else)
-(defconstant $SQL_STMT_OPT_MAX                 SQL_BIND_TYPE
-;; #endif      ;; ODBCVER >= #x0200
 )
 (defconstant $SQL_STMT_OPT_MIN                 SQL_QUERY_TIMEOUT
 
 
 (defconstant $SQL_POSITION 0) ;; 1.0 FALSE
 (defconstant $SQL_REFRESH 1)  ;; 1.0 TRUE
-; #if (ODBCVER >= #x0200))
 (defconstant $SQL_UPDATE 2)
 (defconstant $SQL_DELETE 3)
 (defconstant $SQL_ADD 4)
 (defconstant $SQL_TINYINT -6)
 (defconstant $SQL_BIT -7)
 
+;; For ODBC3
+(defconstant $SQL_TYPE_DATE 91)
+(defconstant $SQL_TYPE_TIME 92)
+(defconstant $SQL_TYPE_TIMESTAMP 93)
+
 (defconstant $SQL_INTERVAL_YEAR -80)
 (defconstant $SQL_INTERVAL_MONTH -81)
 (defconstant $SQL_INTERVAL_YEAR_TO_MONTH -82)
 (defconstant $SQL_C_UTINYINT (+ $SQL_TINYINT $SQL_UNSIGNED_OFFSET)) ;;UNSIGNED TINYINT
 (defconstant $SQL_C_BOOKMARK $SQL_C_ULONG) ;; BOOKMARK
 
+;;; ODBC3
+(defconstant $SQL_C_TYPE_DATE $SQL_TYPE_DATE)
+(defconstant $SQL_C_TYPE_TIME $SQL_TYPE_TIME)
+(defconstant $SQL_C_TYPE_TIMESTAMP $SQL_TYPE_TIMESTAMP)
+
 ;; Options for SQLDriverConnect
 (defconstant $SQL_DRIVER_NOPROMPT 0)
 (defconstant $SQL_DRIVER_COMPLETE 1)
 (defconstant $SQL_DRIVER_PROMPT 2)
 (defconstant $SQL_DRIVER_COMPLETE_REQUIRED 3)
 
+(defconstant $SQL_MAX_CONN_OUT 1024)
+
 ;; Level 2 Functions
 
 ;; SQLExtendedFetch "fFetchType" values
 (defconstant $SQL_FETCH_RELATIVE 6)
 (defconstant $SQL_FETCH_BOOKMARK 8)
 
+;;; ODBC v3 constants, added by KMR
+
+(defconstant $SQL_ATTR_ODBC_VERSION 200)
+(defconstant $SQL_OV_ODBC2 2)
+(defconstant $SQL_OV_ODBC3 3)
+(defconstant $SQL_INDEX_UNIQUE 0)
+(defconstant $SQL_INDEX_ALL 1)
+(defconstant $SQL_QUICK 0)
+(defconstant $SQL_ENSURE 1)
+
+