r11859: Canonicalize whitespace v3.8.6
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 31 Aug 2007 18:04:31 +0000 (18:04 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 31 Aug 2007 18:04:31 +0000 (18:04 +0000)
83 files changed:
db-aodbc/aodbc-package.lisp
db-aodbc/aodbc-sql.lisp
db-db2/db2-api.lisp
db-db2/db2-loader.lisp
db-db2/db2-package.lisp
db-db2/db2-sql.lisp
db-db2/foreign-resources.lisp
db-mysql/clsql_mysql.c
db-mysql/mysql-api.lisp
db-mysql/mysql-client-info.lisp
db-mysql/mysql-objects.lisp
db-mysql/mysql-package.lisp
db-mysql/mysql-sql.lisp
db-mysql/testing/mysql-struct-size.lisp
db-odbc/odbc-api.lisp
db-odbc/odbc-constants.lisp
db-odbc/odbc-dbi.lisp
db-odbc/odbc-ff-interface.lisp
db-odbc/odbc-loader.lisp
db-odbc/odbc-package.lisp
db-odbc/odbc-sql.lisp
db-oracle/foreign-resources.lisp
db-oracle/oracle-api.lisp
db-oracle/oracle-constants.lisp
db-oracle/oracle-objects.lisp
db-oracle/oracle-package.lisp
db-oracle/oracle-sql.lisp
db-postgresql-socket/postgresql-socket-api.lisp
db-postgresql-socket/postgresql-socket-package.lisp
db-postgresql-socket/postgresql-socket-sql.lisp
db-postgresql/postgresql-api.lisp
db-postgresql/postgresql-loader.lisp
db-postgresql/postgresql-package.lisp
db-postgresql/postgresql-sql.lisp
db-sqlite/sqlite-api.lisp
db-sqlite/sqlite-loader.lisp
db-sqlite/sqlite-sql.lisp
db-sqlite3/sqlite3-api.lisp
db-sqlite3/sqlite3-sql.lisp
examples/clsql-tutorial.lisp
examples/sqlite3/init-func/example.lisp
examples/sqlite3/init-func/iso-8859-15-coll.c
sql/ansi-loop.lisp
sql/base-classes.lisp
sql/cmucl-compat.lisp
sql/conditions.lisp
sql/database.lisp
sql/db-interface.lisp
sql/expressions.lisp
sql/fddl.lisp
sql/fdml.lisp
sql/generic-odbc.lisp
sql/generic-postgresql.lisp
sql/generics.lisp
sql/initialize.lisp
sql/kmr-mop.lisp
sql/loop-extension.lisp
sql/metaclasses.lisp
sql/ooddl.lisp
sql/oodml.lisp
sql/operations.lisp
sql/package.lisp
sql/pool.lisp
sql/recording.lisp
sql/sequences.lisp
sql/syntax.lisp
sql/time.lisp
sql/transaction.lisp
sql/utils.lisp
tests/benchmarks.lisp
tests/package.lisp
tests/test-basic.lisp
tests/test-fddl.lisp
tests/test-fdml.lisp
tests/test-init.lisp
tests/test-internal.lisp
tests/test-ooddl.lisp
tests/test-oodml.lisp
tests/test-time.lisp
tests/utils.lisp
uffi/clsql-uffi-loader.lisp
uffi/clsql-uffi.lisp
uffi/clsql_uffi.c

index 171f547..d00e579 100644 (file)
@@ -18,8 +18,8 @@
 
 (in-package #:cl-user)
 
-#+allegro 
-(eval-when (:compile-toplevel :load-toplevel :execute) 
+#+allegro
+(eval-when (:compile-toplevel :load-toplevel :execute)
   (require :aodbc-v2))
 #-allegro (warn "This system requires Allegro's AODBC library to operate")
 
index 8cd3076..e83b3fe 100644 (file)
@@ -28,7 +28,7 @@
   t)
 
 (when (find-package :dbi)
-  (clsql-sys:database-type-load-foreign :aodbc)) 
+  (clsql-sys:database-type-load-foreign :aodbc))
 
 
 ;; AODBC interface
@@ -37,7 +37,7 @@
   ((aodbc-db-type :accessor database-aodbc-db-type :initform :unknown)))
 
 (defmethod database-name-from-spec (connection-spec
-                                   (database-type (eql :aodbc)))
+                                    (database-type (eql :aodbc)))
   (check-connection-spec connection-spec database-type (dsn user password))
   (destructuring-bind (dsn user password) connection-spec
     (declare (ignore password))
   #+aodbc-v2
   (destructuring-bind (dsn user password) connection-spec
     (handler-case
-       (make-instance 'aodbc-database
-         :name (database-name-from-spec connection-spec :aodbc)
-         :database-type :aodbc
-         :dbi-package (find-package '#:dbi)
-         :odbc-conn
-         (dbi:connect :user user
-                      :password password
-                      :data-source-name dsn))
+        (make-instance 'aodbc-database
+          :name (database-name-from-spec connection-spec :aodbc)
+          :database-type :aodbc
+          :dbi-package (find-package '#:dbi)
+          :odbc-conn
+          (dbi:connect :user user
+                       :password password
+                       :data-source-name dsn))
       (sql-error (e)
-       (error e))
-      (error ()        ;; Init or Connect failed
-       (error 'sql-connection-error
-              :database-type database-type
-              :connection-spec connection-spec
-              :message "Connection failed")))))
+        (error e))
+      (error ()         ;; Init or Connect failed
+        (error 'sql-connection-error
+               :database-type database-type
+               :connection-spec connection-spec
+               :message "Connection failed")))))
 
 
-(defmethod database-query (query-expression (database aodbc-database) 
-                          result-types field-names)
+(defmethod database-query (query-expression (database aodbc-database)
+                           result-types field-names)
   #+aodbc-v2
   (handler-case
       (dbi:sql query-expression
-              :db (clsql-sys::odbc-conn database)
-              :types result-types
-              :column-names field-names)
+               :db (clsql-sys::odbc-conn database)
+               :types result-types
+               :column-names field-names)
     #+ignore
     (error ()
       (error 'sql-database-data-error
-            :database database
-            :expression query-expression
-            :message "Query failed"))))
+             :database database
+             :expression query-expression
+             :message "Query failed"))))
 
 (defmethod database-create (connection-spec (type (eql :aodbc)))
   (warn "Not implemented."))
index 880f360..8d4ef01 100644 (file)
 (defmacro def-cli-routine ((c-cli-symbol lisp-cli-fn) c-return &rest c-parms)
   (let ((ll (mapcar (lambda (x) (declare (ignore x)) (gensym)) c-parms)))
     `(let ((%lisp-cli-fn (uffi:def-function
-                            (,c-cli-symbol ,(intern (concatenate 'string "%" (symbol-name lisp-cli-fn))))
-                            ,c-parms
-                            :returning ,c-return)))
+                             (,c-cli-symbol ,(intern (concatenate 'string "%" (symbol-name lisp-cli-fn))))
+                             ,c-parms
+                             :returning ,c-return)))
        (defun ,lisp-cli-fn (,@ll &key database nulls-ok)
-        (let ((result (funcall %lisp-cli-fn ,@ll)))
-          (case result
-            (#.SQL_SUCCESS
-             SQL_SUCCESS)
-            (#.SQL_SUCCESS_WITH_INFO
-             (format *standard-output* "sucess with info")
-             SQL_SUCCESS)
-            (#.SQL_ERROR
-             (error 'sql-database-error
-                    :error-id result
-                    :message
-                    (format nil "DB2 error" result)))
-            (t
-             (error 'sql-database-error
-                    :message
-                    (format nil "DB2 unknown error, code=~A" result)))))))))
-  
+         (let ((result (funcall %lisp-cli-fn ,@ll)))
+           (case result
+             (#.SQL_SUCCESS
+              SQL_SUCCESS)
+             (#.SQL_SUCCESS_WITH_INFO
+              (format *standard-output* "sucess with info")
+              SQL_SUCCESS)
+             (#.SQL_ERROR
+              (error 'sql-database-error
+                     :error-id result
+                     :message
+                     (format nil "DB2 error" result)))
+             (t
+              (error 'sql-database-error
+                     :message
+                     (format nil "DB2 unknown error, code=~A" result)))))))))
+
 
 (defmacro def-raw-cli-routine
   ((c-cli-symbol lisp-cli-fn) c-return &rest c-parms)
   (let ((ll (mapcar (lambda (x) (declare (ignore x)) (gensym)) c-parms)))
     `(let ((%lisp-cli-fn (uffi:def-function (,c-cli-symbol ,(intern (concatenate 'string "%" (symbol-name lisp-cli-fn))))
-                            ,c-parms
-                          :returning ,c-return)))
+                             ,c-parms
+                           :returning ,c-return)))
        (defun ,lisp-cli-fn (,@ll &key database nulls-ok)
-        (funcall %lisp-cli-fn ,@ll)))))
+         (funcall %lisp-cli-fn ,@ll)))))
 
 
 (def-cli-routine ("SQLAllocHandle" sql-alloc-handle)
index 8faf9e3..36701f0 100644 (file)
 (defparameter *db2-lib-path*
   (let ((db2-home (getenv "DB2_HOME")))
     (when db2-home
-      (make-pathname :directory 
-                    (append 
-                     (pathname-directory
-                      (parse-namestring (concatenate 'string db2-home "/")))
+      (make-pathname :directory
+                     (append
+                      (pathname-directory
+                       (parse-namestring (concatenate 'string db2-home "/")))
                       (list "lib"))))))
 
 (defparameter *db2-library-filenames*
@@ -45,7 +45,7 @@ set to the right path before compiling or loading the system.")
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :db2)))
   (clsql-uffi:find-and-load-foreign-library *db2-library-filenames*
                                             :module "clsql-db2"
-                                            :supporting-libraries 
+                                            :supporting-libraries
                                             *db2-supporting-libraries*)
   (setq *db2-library-loaded* t))
 
index 9ca0984..df08104 100644 (file)
@@ -19,7 +19,7 @@
 (defpackage #:clsql-db2
   (:use #:common-lisp #:clsql-sys #:clsql-uffi)
   (:export #:db2-database
-          #:*db2-server-version*
-          #:*db2-so-load-path*
-          #:*db2-so-libraries*)
+           #:*db2-server-version*
+           #:*db2-so-load-path*
+           #:*db2-so-libraries*)
   (:documentation "This is the CLSQL interface to Db2."))
index 6224756..2244f77 100644 (file)
@@ -24,7 +24,7 @@
 
 
 (defmethod database-name-from-spec (connection-spec
-                                   (database-type (eql :db2)))
+                                    (database-type (eql :db2)))
   (check-connection-spec connection-spec database-type (dsn user password))
   (destructuring-bind (dsn user password) connection-spec
     (declare (ignore password))
   (check-connection-spec connection-spec database-type (dsn user password))
   (destructuring-bind (server user password) connection-spec
     (handler-case
-       (let ((db (make-instance 'db2-database
-                   :name (database-name-from-spec connection-spec :db2)
-                   :database-type :db2)))
-         (db2-connect db server user password)
-         db)
-      (error ()        ;; Init or Connect failed
-       (error 'sql-connection-error
-              :database-type database-type
-              :connection-spec connection-spec
-              :message "Connection failed")))))
+        (let ((db (make-instance 'db2-database
+                    :name (database-name-from-spec connection-spec :db2)
+                    :database-type :db2)))
+          (db2-connect db server user password)
+          db)
+      (error ()         ;; Init or Connect failed
+        (error 'sql-connection-error
+               :database-type database-type
+               :connection-spec connection-spec
+               :message "Connection failed")))))
 
 
 ;; API Functions
 
 (defun db2-connect (db server user password)
   (let ((henv (uffi:allocate-foreign-object 'cli-handle))
-       (hdbc (uffi:allocate-foreign-object 'cli-handle)))
+        (hdbc (uffi:allocate-foreign-object 'cli-handle)))
     (sql-alloc-handle SQL_HANDLE_ENV SQL_NULL_HANDLE henv)
     (setf (slot-value db 'henv) henv)
     (setf (slot-value db 'hdbc) hdbc)
-    
+
     (sql-alloc-handle SQL_HANDLE_DBC (deref-vp henv) hdbc)
     (uffi:with-cstrings ((native-server server)
-                        (native-user user)
-                        (native-password password))
+                         (native-user user)
+                         (native-password password))
       (sql-connect (deref-vp hdbc)
-                  native-server SQL_NTS
-                  native-user SQL_NTS
-                  native-password SQL_NTS)))
+                   native-server SQL_NTS
+                   native-user SQL_NTS
+                   native-password SQL_NTS)))
     db)
index 1a8d866..ea17376 100644 (file)
 
 (defstruct (foreign-resource)
   (type (error "Missing TYPE.")
-       :read-only t)
+        :read-only t)
   (sizeof (error "Missing SIZEOF.")
-         :read-only t)
+          :read-only t)
   (buffer (error "Missing BUFFER.")
-         :read-only t)
+          :read-only t)
   (in-use nil :type boolean))
 
 
 (defun %get-resource (type sizeof)
   (let ((resources (gethash type *foreign-resource-hash*)))
     (car (member-if
-         #'(lambda (res)
-             (and (= (foreign-resource-sizeof res) sizeof)
-                  (not (foreign-resource-in-use res))))
-         resources))))
+          #'(lambda (res)
+              (and (= (foreign-resource-sizeof res) sizeof)
+                   (not (foreign-resource-in-use res))))
+          resources))))
 
 (defun %insert-foreign-resource (type res)
   (let ((resource (gethash type *foreign-resource-hash*)))
     (setf (gethash type *foreign-resource-hash*)
-         (cons res resource))))
+          (cons res resource))))
 
 (defmacro acquire-foreign-resource (type &optional size)
   `(let ((res (%get-resource ,type ,size)))
      (unless res
        (setf res (make-foreign-resource
-                 :type ,type :sizeof ,size
-                 :buffer (uffi:allocate-foreign-object ,type ,size)))
+                  :type ,type :sizeof ,size
+                  :buffer (uffi:allocate-foreign-object ,type ,size)))
        (%insert-foreign-resource ',type res))
      (claim-foreign-resource res)))
-              
+
 (defun free-foreign-resource (ares)
   (setf (foreign-resource-in-use ares) nil)
   ares)
index d1bb084..327f14e 100644 (file)
 #include <windows.h>
 
 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
-                         LPVOID lpvReserved)
+                          LPVOID lpvReserved)
 {
         return 1;
 }
-       
+
 #define DLLEXPORT __declspec(dllexport)
 
 #else
-#define DLLEXPORT 
+#define DLLEXPORT
 #endif
 
 
@@ -37,19 +37,19 @@ BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
 DLLEXPORT
 void
 clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
-                      unsigned int offset_low32)
+                       unsigned int offset_low32)
 {
   my_ulonglong offset;
 
   offset = offset_high32;
   offset = offset << 32;
   offset += offset_low32;
-  
+
   mysql_data_seek (res, offset);
 }
 
 /* The following functions are used to return 64-bit integers to Lisp.
-   They return the 32-bit low part and store in upper 32-bits in a 
+   They return the 32-bit low part and store in upper 32-bits in a
    located sent via a pointer */
 
 static const unsigned int bitmask_32bits = 0xFFFFFFFF;
@@ -127,8 +127,8 @@ allocate_bind (unsigned int n)
 
 DLLEXPORT
 void
-bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null, 
-          void* buffer, unsigned short buffer_type, unsigned long buffer_length)
+bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null,
+           void* buffer, unsigned short buffer_type, unsigned long buffer_length)
 {
   *bind[n].length = length;
   *bind[n].is_null = is_null;
index 39af26f..59cbe8c 100644 (file)
 (defun mysql-num-rows (res)
   (uffi:with-foreign-object (p-high32 :unsigned-int)
     (let ((low32 (clsql-mysql-num-rows res p-high32))
-         (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
+          (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
       (if (zerop high32)
-         low32
-       (make-64-bit-integer high32 low32)))))
+          low32
+        (make-64-bit-integer high32 low32)))))
 
 (uffi:def-function "clsql_mysql_affected_rows"
     ((mysql (* mysql-mysql))
 (defun mysql-affected-rows (mysql)
   (uffi:with-foreign-object (p-high32 :unsigned-int)
     (let ((low32 (clsql-mysql-affected-rows mysql p-high32))
-         (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
+          (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
       (if (zerop high32)
-         low32
-       (make-64-bit-integer high32 low32)))))
+          low32
+        (make-64-bit-integer high32 low32)))))
 
 (uffi:def-function "clsql_mysql_insert_id"
     ((res (* mysql-mysql))
 (defun mysql-insert-id (mysql)
   (uffi:with-foreign-object (p-high32 :unsigned-int)
   (let ((low32 (clsql-mysql-insert-id mysql p-high32))
-       (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
+        (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
     (if (zerop high32)
-       low32
+        low32
       (make-64-bit-integer high32 low32)))))
 
 
index 4124e0b..0721194 100644 (file)
 
 
   (when (and (stringp *mysql-client-info*)
-            (plusp (length *mysql-client-info*)))
+             (plusp (length *mysql-client-info*)))
     (cond
       ((eql (schar *mysql-client-info* 0) #\3)
        (pushnew :mysql-client-v3 cl:*features*))
       ((eql (schar *mysql-client-info* 0) #\4)
        (pushnew :mysql-client-v4 cl:*features*)
        (when (and (>= (length *mysql-client-info*) 3)
-                 (string-equal "4.1" *mysql-client-info* :end2 3))
-        (pushnew :mysql-client-v4.1 cl:*features*)))
+                  (string-equal "4.1" *mysql-client-info* :end2 3))
+         (pushnew :mysql-client-v4.1 cl:*features*)))
       ((eql (schar *mysql-client-info* 0) #\5)
        (pushnew :mysql-client-v5 cl:*features*))
       (t
index 64c844e..76ce5e5 100644 (file)
 (in-package #:clsql-mysql)
 
 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore args database))
   "DATETIME")
 
 (defmethod database-get-type-specifier ((type (eql 'smallint)) args database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore args database))
   "SMALLINT")
 
 (defmethod database-get-type-specifier ((type (eql 'mediumint)) args database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore args database))
   "MEDIUMINT")
 
 (defmethod database-get-type-specifier ((type (eql 'tinyint)) args database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore args database))
   "TINYINT")
 
 (defmethod database-output-sql-as-type ((type (eql 'boolean)) val database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore database))
   (if val 1 0))
 
 (defmethod database-output-sql-as-type ((type (eql 'generalized-boolean)) val database
-                                       (db-type (eql :mysql)))
+                                        (db-type (eql :mysql)))
   (declare (ignore database))
   (if val 1 0))
 
 (defmethod read-sql-value (val (type (eql 'boolean)) database
-                          (db-type (eql :mysql)))
-  (declare (ignore database)) 
+                           (db-type (eql :mysql)))
+  (declare (ignore database))
   (etypecase val
     (string (if (string= "0" val) nil t))
     (integer (if (zerop val) nil t))))
 
 (defmethod read-sql-value (val (type (eql 'generalized-boolean)) database
-                          (db-type (eql :mysql)))
-  (declare (ignore database)) 
+                           (db-type (eql :mysql)))
+  (declare (ignore database))
   (etypecase val
     (string (if (string= "0" val) nil t))
     (integer (if (zerop val) nil t))))
index 368dfe7..58b04ce 100644 (file)
@@ -20,9 +20,9 @@
 
 (defpackage #:mysql
     (:use #:common-lisp #:clsql-uffi)
-    (:export 
+    (:export
      #:database-library-loaded
-     
+
      #:mysql-socket
      #:mysql-book
      #:mysql-byte
      #:mysql-info
      #:mysql-info-string
      #:mysql-data-seek
-     
+
      #:mysql-time
      #:mysql-bind
      #:mysql-stmt-param-count
      #:mysql-stmt-close
      #:mysql-stmt-errno
      #:mysql-stmt-error
-     
+
      #:make-64-bit-integer
      )
     (:documentation "This is the low-level interface MySQL."))
index a0e21c8..00430a3 100644 (file)
 ;; if we have :sb-unicode, UFFI will treat :cstring as a UTF-8 string
 (defun expression-length (query-expression)
   (length #+sb-unicode (sb-ext:string-to-octets query-expression
-                                               :external-format :utf8)
-         #-sb-unicode query-expression))
+                                                :external-format :utf8)
+          #-sb-unicode query-expression))
 
 ;;; Field conversion functions
 
 (defun result-field-names (num-fields res-ptr)
   (declare (fixnum num-fields))
   (let ((names '())
-       (field-vec (mysql-fetch-fields res-ptr)))
+        (field-vec (mysql-fetch-fields res-ptr)))
     (dotimes (i num-fields)
       (declare (fixnum i))
       (let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
     (dotimes (i num-fields)
       (declare (fixnum i))
       (let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
-            (flags (uffi:get-slot-value field 'mysql-field 'mysql::flags))
-            (unsigned (plusp (logand flags 32)))
-            (type (uffi:get-slot-value field 'mysql-field 'type)))
-       (push
-        (case type
-          ((#.mysql-field-types#tiny
-            #.mysql-field-types#short
-            #.mysql-field-types#int24)
-           (if unsigned
-               :uint32
-             :int32))
-          (#.mysql-field-types#long
-           (if unsigned
-               :uint
-             :int))
-           (#.mysql-field-types#longlong
-            (if unsigned
-                :uint64
-              :int64))
-          ((#.mysql-field-types#double
-            #.mysql-field-types#float
-            #.mysql-field-types#decimal)
-           :double)
-          (otherwise
-           t))
-        new-types)))
+             (flags (uffi:get-slot-value field 'mysql-field 'mysql::flags))
+             (unsigned (plusp (logand flags 32)))
+             (type (uffi:get-slot-value field 'mysql-field 'type)))
+        (push
+         (case type
+           ((#.mysql-field-types#tiny
+             #.mysql-field-types#short
+             #.mysql-field-types#int24)
+            (if unsigned
+                :uint32
+              :int32))
+           (#.mysql-field-types#long
+            (if unsigned
+                :uint
+              :int))
+            (#.mysql-field-types#longlong
+             (if unsigned
+                 :uint64
+               :int64))
+           ((#.mysql-field-types#double
+             #.mysql-field-types#float
+             #.mysql-field-types#decimal)
+            :double)
+           (otherwise
+            t))
+         new-types)))
     (nreverse new-types)))
 
 (defun canonicalize-types (types num-fields res-ptr)
   (when types
     (let ((auto-list (make-type-list-for-auto num-fields res-ptr)))
       (cond
-       ((listp types)
-        (canonicalize-type-list types auto-list))
-       ((eq types :auto)
-        auto-list)
-       (t
-        nil)))))
+        ((listp types)
+         (canonicalize-type-list types auto-list))
+        ((eq types :auto)
+         auto-list)
+        (t
+         nil)))))
 
 (defmethod database-initialize-database-type ((database-type (eql :mysql)))
   t)
 
 (defclass mysql-database (database)
   ((mysql-ptr :accessor database-mysql-ptr :initarg :mysql-ptr
-             :type mysql-mysql-ptr-def)
+              :type mysql-mysql-ptr-def)
    (server-info :accessor database-server-info :initarg :server-info
-             :type string)))
+              :type string)))
 
 (defmethod database-type ((database mysql-database))
   :mysql)
 
 (defmethod database-name-from-spec (connection-spec (database-type (eql :mysql)))
   (check-connection-spec connection-spec database-type
-                        (host db user password &optional port))
+                         (host db user password &optional port))
   (destructuring-bind (host db user password &optional port) connection-spec
     (declare (ignore password))
     (concatenate 'string
-                (etypecase host
-                  (null "localhost")
-                  (pathname (namestring host))
-                  (string host))
-                (if port
-                    (concatenate 'string
-                                 ":"
-                                 (etypecase port
-                                   (integer (write-to-string port))
-                                   (string port)))
-                    "")
-                "/" db "/" user)))
+                 (etypecase host
+                   (null "localhost")
+                   (pathname (namestring host))
+                   (string host))
+                 (if port
+                     (concatenate 'string
+                                  ":"
+                                  (etypecase port
+                                    (integer (write-to-string port))
+                                    (string port)))
+                     "")
+                 "/" db "/" user)))
 
 (defmethod database-connect (connection-spec (database-type (eql :mysql)))
   (check-connection-spec connection-spec database-type
-                        (host db user password &optional port))
+                         (host db user password &optional port))
   (destructuring-bind (host db user password &optional port) connection-spec
     (let ((mysql-ptr (mysql-init (uffi:make-null-pointer 'mysql-mysql)))
-         (socket nil))
+          (socket nil))
       (if (uffi:null-pointer-p mysql-ptr)
-         (error 'sql-connection-error
-                :database-type database-type
-                :connection-spec connection-spec
-                :error-id (mysql-errno mysql-ptr)
-                :message (mysql-error-string mysql-ptr))
-       (uffi:with-cstrings ((host-native host)
-                           (user-native user)
-                           (password-native password)
-                           (db-native db)
-                           (socket-native socket))
-         (let ((error-occurred nil))
-           (unwind-protect
-               (if (uffi:null-pointer-p
-                    (mysql-real-connect
-                     mysql-ptr host-native user-native password-native
-                     db-native
-                     (etypecase port
-                       (null 0)
-                       (integer port)
-                       (string (parse-integer port)))
-                     socket-native 0))
-                   (progn
-                     (setq error-occurred t)
-                     (error 'sql-connection-error
-                            :database-type database-type
-                            :connection-spec connection-spec
-                            :error-id (mysql-errno mysql-ptr)
-                            :message (mysql-error-string mysql-ptr)))
-                 (make-instance 'mysql-database
-                                :name (database-name-from-spec connection-spec
-                                                               database-type)
-                                :database-type :mysql
-                                :connection-spec connection-spec
-                                :server-info (uffi:convert-from-cstring
-                                              (mysql:mysql-get-server-info mysql-ptr))
-                                :mysql-ptr mysql-ptr))
-             (when error-occurred (mysql-close mysql-ptr)))))))))
+          (error 'sql-connection-error
+                 :database-type database-type
+                 :connection-spec connection-spec
+                 :error-id (mysql-errno mysql-ptr)
+                 :message (mysql-error-string mysql-ptr))
+        (uffi:with-cstrings ((host-native host)
+                            (user-native user)
+                            (password-native password)
+                            (db-native db)
+                            (socket-native socket))
+          (let ((error-occurred nil))
+            (unwind-protect
+                (if (uffi:null-pointer-p
+                     (mysql-real-connect
+                      mysql-ptr host-native user-native password-native
+                      db-native
+                      (etypecase port
+                        (null 0)
+                        (integer port)
+                        (string (parse-integer port)))
+                      socket-native 0))
+                    (progn
+                      (setq error-occurred t)
+                      (error 'sql-connection-error
+                             :database-type database-type
+                             :connection-spec connection-spec
+                             :error-id (mysql-errno mysql-ptr)
+                             :message (mysql-error-string mysql-ptr)))
+                  (make-instance 'mysql-database
+                                 :name (database-name-from-spec connection-spec
+                                                                database-type)
+                                 :database-type :mysql
+                                 :connection-spec connection-spec
+                                 :server-info (uffi:convert-from-cstring
+                                               (mysql:mysql-get-server-info mysql-ptr))
+                                 :mysql-ptr mysql-ptr))
+              (when error-occurred (mysql-close mysql-ptr)))))))))
 
 
 (defmethod database-disconnect ((database mysql-database))
 
 
 (defmethod database-query (query-expression (database mysql-database)
-                          result-types field-names)
+                           result-types field-names)
   (declare (optimize (speed 3) (safety 0) (debug 0) (space 0)))
   (let ((mysql-ptr (database-mysql-ptr database)))
     (uffi:with-cstring (query-native query-expression)
       (if (zerop (mysql-real-query mysql-ptr query-native
                                    (expression-length query-expression)))
-         (let ((res-ptr (mysql-use-result mysql-ptr)))
-           (if res-ptr
-               (unwind-protect
-                    (let ((num-fields (mysql-num-fields res-ptr)))
-                      (declare (fixnum num-fields))
-                      (setq result-types (canonicalize-types
-                                   result-types num-fields
-                                   res-ptr))
+          (let ((res-ptr (mysql-use-result mysql-ptr)))
+            (if res-ptr
+                (unwind-protect
+                     (let ((num-fields (mysql-num-fields res-ptr)))
+                       (declare (fixnum num-fields))
+                       (setq result-types (canonicalize-types
+                                    result-types num-fields
+                                    res-ptr))
                        (values
                         (loop for row = (mysql-fetch-row res-ptr)
                               for lengths = (mysql-fetch-lengths res-ptr)
                                                          i)))))
                         (when field-names
                           (result-field-names num-fields res-ptr))))
-                 (mysql-free-result res-ptr))
-               (error 'sql-database-data-error
-                      :database database
-                      :expression query-expression
-                      :error-id (mysql-errno mysql-ptr)
-                      :message (mysql-error-string mysql-ptr))))
-         (error 'sql-database-data-error
-                :database database
-                :expression query-expression
-                :error-id (mysql-errno mysql-ptr)
-                :message (mysql-error-string mysql-ptr))))))
+                  (mysql-free-result res-ptr))
+                (error 'sql-database-data-error
+                       :database database
+                       :expression query-expression
+                       :error-id (mysql-errno mysql-ptr)
+                       :message (mysql-error-string mysql-ptr))))
+          (error 'sql-database-data-error
+                 :database database
+                 :expression query-expression
+                 :error-id (mysql-errno mysql-ptr)
+                 :message (mysql-error-string mysql-ptr))))))
 
 (defmethod database-execute-command (sql-expression (database mysql-database))
   (uffi:with-cstring (sql-native sql-expression)
       (declare (type mysql-mysql-ptr-def mysql-ptr))
       (if (zerop (mysql-real-query mysql-ptr sql-native
                                    (expression-length sql-expression)))
-         t
-       (error 'sql-database-data-error
-              :database database
-              :expression sql-expression
-              :error-id (mysql-errno mysql-ptr)
-              :message (mysql-error-string mysql-ptr))))))
+          t
+        (error 'sql-database-data-error
+               :database database
+               :expression sql-expression
+               :error-id (mysql-errno mysql-ptr)
+               :message (mysql-error-string mysql-ptr))))))
 
 
 (defstruct mysql-result-set
 
 
 (defmethod database-query-result-set ((query-expression string)
-                                     (database mysql-database)
-                                     &key full-set result-types)
+                                      (database mysql-database)
+                                      &key full-set result-types)
   (uffi:with-cstring (query-native query-expression)
     (let ((mysql-ptr (database-mysql-ptr database)))
      (declare (type mysql-mysql-ptr-def mysql-ptr))
       (if (zerop (mysql-real-query mysql-ptr query-native
                                    (expression-length query-expression)))
-         (let ((res-ptr (if full-set
-                            (mysql-store-result mysql-ptr)
-                          (mysql-use-result mysql-ptr))))
-           (declare (type mysql-mysql-res-ptr-def res-ptr))
-           (if (not (uffi:null-pointer-p res-ptr))
-               (let* ((num-fields (mysql-num-fields res-ptr))
-                      (result-set (make-mysql-result-set
-                                   :res-ptr res-ptr
-                                   :num-fields num-fields
-                                   :full-set full-set
-                                   :types
-                                   (canonicalize-types
-                                    result-types num-fields
-                                    res-ptr))))
-                 (if full-set
-                     (values result-set
-                             num-fields
-                             (mysql-num-rows res-ptr))
-                     (values result-set
-                             num-fields)))
-               (error 'sql-database-data-error
-                    :database database
-                    :expression query-expression
-                    :error-id (mysql-errno mysql-ptr)
-                    :message (mysql-error-string mysql-ptr))))
-       (error 'sql-database-data-error
-              :database database
-              :expression query-expression
-              :error-id (mysql-errno mysql-ptr)
-              :message (mysql-error-string mysql-ptr))))))
+          (let ((res-ptr (if full-set
+                             (mysql-store-result mysql-ptr)
+                           (mysql-use-result mysql-ptr))))
+            (declare (type mysql-mysql-res-ptr-def res-ptr))
+            (if (not (uffi:null-pointer-p res-ptr))
+                (let* ((num-fields (mysql-num-fields res-ptr))
+                       (result-set (make-mysql-result-set
+                                    :res-ptr res-ptr
+                                    :num-fields num-fields
+                                    :full-set full-set
+                                    :types
+                                    (canonicalize-types
+                                     result-types num-fields
+                                     res-ptr))))
+                  (if full-set
+                      (values result-set
+                              num-fields
+                              (mysql-num-rows res-ptr))
+                      (values result-set
+                              num-fields)))
+                (error 'sql-database-data-error
+                     :database database
+                     :expression query-expression
+                     :error-id (mysql-errno mysql-ptr)
+                     :message (mysql-error-string mysql-ptr))))
+        (error 'sql-database-data-error
+               :database database
+               :expression query-expression
+               :error-id (mysql-errno mysql-ptr)
+               :message (mysql-error-string mysql-ptr))))))
 
 (defmethod database-dump-result-set (result-set (database mysql-database))
   (mysql-free-result (mysql-result-set-res-ptr result-set))
 
 (defmethod database-store-next-row (result-set (database mysql-database) list)
   (let* ((res-ptr (mysql-result-set-res-ptr result-set))
-        (row (mysql-fetch-row res-ptr))
+         (row (mysql-fetch-row res-ptr))
          (lengths (mysql-fetch-lengths res-ptr))
-        (types (mysql-result-set-types result-set)))
+         (types (mysql-result-set-types result-set)))
     (declare (type mysql-mysql-res-ptr-def res-ptr)
-            (type mysql-row-def row))
+             (type mysql-row-def row))
     (unless (uffi:null-pointer-p row)
       (loop for i from 0 below (mysql-result-set-num-fields result-set)
-           for rest on list
-           do
-           (setf (car rest)
-                 (convert-raw-field
-                  (uffi:deref-array row '(:array (* :unsigned-char)) i)
-                  types
-                  i
+            for rest on list
+            do
+            (setf (car rest)
+                  (convert-raw-field
+                   (uffi:deref-array row '(:array (* :unsigned-char)) i)
+                   types
+                   i
                    (uffi:deref-array lengths '(:array :unsigned-long) i))))
       list)))
 
           collect name))
    (t
     (remove-if #'(lambda (s)
-                  (and (>= (length s) 11)
-                       (string-equal (subseq s 0 11) "_CLSQL_SEQ_")))
-              (mapcar #'car (database-query "SHOW TABLES" database nil nil))))))
+                   (and (>= (length s) 11)
+                        (string-equal (subseq s 0 11) "_CLSQL_SEQ_")))
+               (mapcar #'car (database-query "SHOW TABLES" database nil nil))))))
 
 (defmethod database-list-views ((database mysql-database)
                                 &key (owner nil))
   (let ((result '()))
     (dolist (table (database-list-tables database :owner owner) result)
       (setq result
-       (append (database-list-table-indexes table database :owner owner)
-               result)))))
+        (append (database-list-table-indexes table database :owner owner)
+                result)))))
 
 (defmethod database-list-table-indexes (table (database mysql-database)
-                                       &key (owner nil))
+                                        &key (owner nil))
   (declare (ignore owner))
   (do ((results nil)
        (rows (database-query
-             (format nil "SHOW INDEX FROM ~A" (string-upcase table))
-             database nil nil)
-            (cdr rows)))
+              (format nil "SHOW INDEX FROM ~A" (string-upcase table))
+              database nil nil)
+             (cdr rows)))
       ((null rows) (nreverse results))
     (let ((col (nth 2 (car rows))))
       (unless (find col results :test #'string-equal)
-       (push col results)))))
+        (push col results)))))
 
 (defmethod database-list-attributes ((table string) (database mysql-database)
                                      &key (owner nil))
   (declare (ignore owner))
   (mapcar #'car
-         (database-query
-          (format nil "SHOW COLUMNS FROM ~A" table)
-          database nil nil)))
+          (database-query
+           (format nil "SHOW COLUMNS FROM ~A" table)
+           database nil nil)))
 
 (defmethod database-attribute-type (attribute (table string)
-                                   (database mysql-database)
+                                    (database mysql-database)
                                     &key (owner nil))
   (declare (ignore owner))
   (let ((row (car (database-query
-                  (format nil
-                          "SHOW COLUMNS FROM ~A LIKE '~A'" table attribute)
-                  database nil nil))))
+                   (format nil
+                           "SHOW COLUMNS FROM ~A LIKE '~A'" table attribute)
+                   database nil nil))))
     (let* ((raw-type (second row))
-          (null (third row))
-          (start-length (position #\( raw-type))
-          (type (if start-length
-                    (subseq raw-type 0 start-length)
-                    raw-type))
-          (length (when start-length
-                    (parse-integer (subseq raw-type (1+ start-length))
-                                   :junk-allowed t))))
+           (null (third row))
+           (start-length (position #\( raw-type))
+           (type (if start-length
+                     (subseq raw-type 0 start-length)
+                     raw-type))
+           (length (when start-length
+                     (parse-integer (subseq raw-type (1+ start-length))
+                                    :junk-allowed t))))
       (when type
-       (values (ensure-keyword type) length nil (if (string-equal null "YES") 1 0))))))
+        (values (ensure-keyword type) length nil (if (string-equal null "YES") 1 0))))))
 
 ;;; Sequence functions
 
        (subseq table-name 11)))
 
 (defmethod database-create-sequence (sequence-name
-                                    (database mysql-database))
+                                     (database mysql-database))
   (let ((table-name (%sequence-name-to-table sequence-name)))
     (database-execute-command
      (concatenate 'string "CREATE TABLE " table-name
-                 " (id int NOT NULL PRIMARY KEY AUTO_INCREMENT)")
+                  " (id int NOT NULL PRIMARY KEY AUTO_INCREMENT)")
      database)
     (database-execute-command
      (concatenate 'string "INSERT INTO " table-name
-                 " VALUES (-1)")
+                  " VALUES (-1)")
      database)))
 
 (defmethod database-drop-sequence (sequence-name
-                                  (database mysql-database))
+                                   (database mysql-database))
   (database-execute-command
    (concatenate 'string "DROP TABLE " (%sequence-name-to-table sequence-name))
    database))
   (mapcan #'(lambda (s)
               (let ((sn (%table-name-to-sequence-name (car s))))
                 (and sn (list sn))))
-         (database-query "SHOW TABLES" database nil nil)))
+          (database-query "SHOW TABLES" database nil nil)))
 
 (defmethod database-set-sequence-position (sequence-name
                                            (position integer)
   (without-interrupts
    (database-execute-command
     (concatenate 'string "UPDATE " (%sequence-name-to-table sequence-name)
-                " SET id=LAST_INSERT_ID(id+1)")
+                 " SET id=LAST_INSERT_ID(id+1)")
     database)
    (mysql:mysql-insert-id (clsql-mysql::database-mysql-ptr database))))
 
 (defmethod database-sequence-last (sequence-name (database mysql-database))
   (without-interrupts
     (caar (database-query
-          (concatenate 'string "SELECT id from "
-                       (%sequence-name-to-table sequence-name))
-          database :auto nil))))
+           (concatenate 'string "SELECT id from "
+                        (%sequence-name-to-table sequence-name))
+           database :auto nil))))
 
 (defmethod database-create (connection-spec (type (eql :mysql)))
   (destructuring-bind (host name user password &optional port) connection-spec
     (multiple-value-bind (output status)
-       (clsql-sys:command-output "mysqladmin create -u~A -p~A -h~A~@[ -P~A~] ~A"
-                                      user password
-                                      (if host host "localhost")
-                                      port name
-                                      name)
+        (clsql-sys:command-output "mysqladmin create -u~A -p~A -h~A~@[ -P~A~] ~A"
+                                       user password
+                                       (if host host "localhost")
+                                       port name
+                                       name)
       (if (or (not (eql 0 status))
-             (and (search "failed" output) (search "error" output)))
-         (error 'sql-database-error
-                :message
-                (format nil "mysql database creation failed with connection-spec ~A."
-                        connection-spec))
-       t))))
+              (and (search "failed" output) (search "error" output)))
+          (error 'sql-database-error
+                 :message
+                 (format nil "mysql database creation failed with connection-spec ~A."
+                         connection-spec))
+        t))))
 
 (defmethod database-destroy (connection-spec (type (eql :mysql)))
   (destructuring-bind (host name user password &optional port) connection-spec
     (multiple-value-bind (output status)
-       (clsql-sys:command-output "mysqladmin drop -f -u~A -p~A -h~A~@[ -P~A~] ~A"
-                                      user password
-                                      (if host host "localhost")
-                                      port name)
+        (clsql-sys:command-output "mysqladmin drop -f -u~A -p~A -h~A~@[ -P~A~] ~A"
+                                       user password
+                                       (if host host "localhost")
+                                       port name)
       (if (or (not (eql 0 status))
-             (and (search "failed" output) (search "error" output)))
-         (error 'sql-database-error
-                :message
-                (format nil "mysql database deletion failed with connection-spec ~A."
-                        connection-spec))
-       t))))
+              (and (search "failed" output) (search "error" output)))
+          (error 'sql-database-error
+                 :message
+                 (format nil "mysql database deletion failed with connection-spec ~A."
+                         connection-spec))
+        t))))
 
 (defmethod database-probe (connection-spec (type (eql :mysql)))
   (when (find (second connection-spec) (database-list connection-spec type)
     (declare (ignore name))
     (let ((database (database-connect (list host "mysql" user password port) type)))
       (unwind-protect
-          (progn
-            (setf (slot-value database 'clsql-sys::state) :open)
-            (mapcar #'car (database-query "show databases" database :auto nil)))
-       (progn
-         (database-disconnect database)
-         (setf (slot-value database 'clsql-sys::state) :closed))))))
+           (progn
+             (setf (slot-value database 'clsql-sys::state) :open)
+             (mapcar #'car (database-query "show databases" database :auto nil)))
+        (progn
+          (database-disconnect database)
+          (setf (slot-value database 'clsql-sys::state) :closed))))))
 
 
 ;;; Prepared statements
     ((or (eq type :blob) (and (consp type) (in (car type) :blob))) mysql-field-types#var-string)
     (t
        (error 'sql-user-error
-             :message
-             (format nil "Unknown clsql type ~A." type)))))
+              :message
+              (format nil "Unknown clsql type ~A." type)))))
 
 #+mysql-client-v4.1
 (defmethod database-prepare (sql-stmt types (database mysql-database) result-types field-names)
   (let* ((mysql-ptr (database-mysql-ptr database))
-        (stmt (mysql-stmt-init mysql-ptr)))
+         (stmt (mysql-stmt-init mysql-ptr)))
     (when (uffi:null-pointer-p stmt)
       (error 'sql-database-error
-            :error-id (mysql-errno mysql-ptr)
-            :message (mysql-error-string mysql-ptr)))
+             :error-id (mysql-errno mysql-ptr)
+             :message (mysql-error-string mysql-ptr)))
 
     (uffi:with-cstring (native-query sql-stmt)
       (unless (zerop (mysql-stmt-prepare stmt native-query (expression-length sql-stmt)))
-       (mysql-stmt-close stmt)
-       (error 'sql-database-error
-              :error-id (mysql-errno mysql-ptr)
-              :message (mysql-error-string mysql-ptr))))
+        (mysql-stmt-close stmt)
+        (error 'sql-database-error
+               :error-id (mysql-errno mysql-ptr)
+               :message (mysql-error-string mysql-ptr))))
 
     (unless (= (mysql-stmt-param-count stmt) (length types))
       (mysql-stmt-close stmt)
       (error 'sql-database-error
-            :message
-            (format nil "Mysql param count (~D) does not match number of types (~D)"
-                    (mysql-stmt-param-count stmt) (length types))))
+             :message
+             (format nil "Mysql param count (~D) does not match number of types (~D)"
+                     (mysql-stmt-param-count stmt) (length types))))
 
     (let ((rs (mysql-stmt-result-metadata stmt)))
       (when (uffi:null-pointer-p rs)
-       (warn "mysql_stmt_result_metadata returned NULL")
-       #+nil
-       (mysql-stmt-close stmt)
-       #+nil
-       (error 'sql-database-error
-              :message "mysql_stmt_result_metadata returned NULL"))
+        (warn "mysql_stmt_result_metadata returned NULL")
+        #+nil
+        (mysql-stmt-close stmt)
+        #+nil
+        (error 'sql-database-error
+               :message "mysql_stmt_result_metadata returned NULL"))
 
       (let ((input-bind (uffi:allocate-foreign-object 'mysql-bind (length types)))
-           (mysql-types (mapcar 'clsql-type->mysql-type types))
-           field-vec num-fields is-null-ptr output-bind length-ptr)
-
-       (print 'a)
-       (dotimes (i (length types))
-         (let* ((binding (uffi:deref-array input-bind '(:array mysql-bind) i)))
-           (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type)
-             (nth i mysql-types))
-           (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 0)))
-
-       (print 'b)
-       (unless (uffi:null-pointer-p rs)
-         (setq field-vec (mysql-fetch-fields rs)
-               num-fields (mysql-num-fields rs)
-               is-null-ptr (uffi:allocate-foreign-object :byte num-fields)
-               output-bind (uffi:allocate-foreign-object 'mysql-bind num-fields)
-               length-ptr (uffi:allocate-foreign-object :unsigned-long num-fields))
-         (dotimes (i num-fields)
-           (declare (fixnum i))
-           (let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
-                  (type (uffi:get-slot-value field 'mysql-field 'type))
-                  (binding (uffi:deref-array output-bind '(:array mysql-bind) i)))
-             (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type) type)
-
-             (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 0)
-             #+need-to-allocate-foreign-object-for-this
-             (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::is-null)
-               (+ i (uffi:pointer-address is-null-ptr)))
-             #+need-to-allocate-foreign-object-for-this
-             (setf (uffi:get-slot-value binding 'mysql-bind 'length)
-               (+ (* i 8) (uffi:pointer-address length-ptr)))
-
-             (case type
-               ((#.mysql-field-types#var-string #.mysql-field-types#string
-                 #.mysql-field-types#tiny-blob #.mysql-field-types#blob
-                 #.mysql-field-types#medium-blob #.mysql-field-types#long-blob)
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 1024)
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :unsigned-char 1024)))
-               (#.mysql-field-types#tiny
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :byte)))
-               (#.mysql-field-types#short
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :short)))
-               (#.mysql-field-types#long
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  ;; segfaults if supply :int on amd64
-                  (uffi:allocate-foreign-object :long)))
-               #+64bit
-               (#.mysql-field-types#longlong
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :long)))
-               (#.mysql-field-types#float
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :float)))
-               (#.mysql-field-types#double
-                (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
-                  (uffi:allocate-foreign-object :double)))
-               ((#.mysql-field-types#time #.mysql-field-types#date
-                 #.mysql-field-types#datetime #.mysql-field-types#timestamp)
-                (uffi:allocate-foreign-object 'mysql-time))
-               (t
-                (error "mysql type ~D not supported." type)))))
-
-         (unless (zerop (mysql-stmt-bind-result stmt output-bind))
-           (mysql-stmt-close stmt)
-           (error 'sql-database-error
-                  :error-id (mysql-stmt-errno stmt)
-                  :message  (uffi:convert-from-cstring
-                             (mysql-stmt-error stmt)))))
-
-       (make-instance 'mysql-stmt
-         :database database
-         :stmt stmt
-         :num-fields num-fields
-         :input-bind input-bind
-         :output-bind output-bind
-         :result-set rs
-         :result-types result-types
-         :length-ptr length-ptr
-         :is-null-ptr is-null-ptr
-         :types mysql-types
-         :field-names field-names)))))
+            (mysql-types (mapcar 'clsql-type->mysql-type types))
+            field-vec num-fields is-null-ptr output-bind length-ptr)
+
+        (print 'a)
+        (dotimes (i (length types))
+          (let* ((binding (uffi:deref-array input-bind '(:array mysql-bind) i)))
+            (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type)
+              (nth i mysql-types))
+            (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 0)))
+
+        (print 'b)
+        (unless (uffi:null-pointer-p rs)
+          (setq field-vec (mysql-fetch-fields rs)
+                num-fields (mysql-num-fields rs)
+                is-null-ptr (uffi:allocate-foreign-object :byte num-fields)
+                output-bind (uffi:allocate-foreign-object 'mysql-bind num-fields)
+                length-ptr (uffi:allocate-foreign-object :unsigned-long num-fields))
+          (dotimes (i num-fields)
+            (declare (fixnum i))
+            (let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
+                   (type (uffi:get-slot-value field 'mysql-field 'type))
+                   (binding (uffi:deref-array output-bind '(:array mysql-bind) i)))
+              (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type) type)
+
+              (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 0)
+              #+need-to-allocate-foreign-object-for-this
+              (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::is-null)
+                (+ i (uffi:pointer-address is-null-ptr)))
+              #+need-to-allocate-foreign-object-for-this
+              (setf (uffi:get-slot-value binding 'mysql-bind 'length)
+                (+ (* i 8) (uffi:pointer-address length-ptr)))
+
+              (case type
+                ((#.mysql-field-types#var-string #.mysql-field-types#string
+                  #.mysql-field-types#tiny-blob #.mysql-field-types#blob
+                  #.mysql-field-types#medium-blob #.mysql-field-types#long-blob)
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-length) 1024)
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :unsigned-char 1024)))
+                (#.mysql-field-types#tiny
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :byte)))
+                (#.mysql-field-types#short
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :short)))
+                (#.mysql-field-types#long
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   ;; segfaults if supply :int on amd64
+                   (uffi:allocate-foreign-object :long)))
+                #+64bit
+                (#.mysql-field-types#longlong
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :long)))
+                (#.mysql-field-types#float
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :float)))
+                (#.mysql-field-types#double
+                 (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer)
+                   (uffi:allocate-foreign-object :double)))
+                ((#.mysql-field-types#time #.mysql-field-types#date
+                  #.mysql-field-types#datetime #.mysql-field-types#timestamp)
+                 (uffi:allocate-foreign-object 'mysql-time))
+                (t
+                 (error "mysql type ~D not supported." type)))))
+
+          (unless (zerop (mysql-stmt-bind-result stmt output-bind))
+            (mysql-stmt-close stmt)
+            (error 'sql-database-error
+                   :error-id (mysql-stmt-errno stmt)
+                   :message  (uffi:convert-from-cstring
+                              (mysql-stmt-error stmt)))))
+
+        (make-instance 'mysql-stmt
+          :database database
+          :stmt stmt
+          :num-fields num-fields
+          :input-bind input-bind
+          :output-bind output-bind
+          :result-set rs
+          :result-types result-types
+          :length-ptr length-ptr
+          :is-null-ptr is-null-ptr
+          :types mysql-types
+          :field-names field-names)))))
 
 #+mysql-client-v4.1
 (defmethod database-bind-parameter ((stmt mysql-stmt) position value)
   ;; FIXME: will need to allocate bind structure. This should probably be
   ;; done in C since the API is not mature and may change
   (let ((binding (uffi:deref-array (input-bind stmt) '(:array mysql-bind) (1- position)))
-       (type (nth (1- position) (types stmt))))
+        (type (nth (1- position) (types stmt))))
     (setf (uffi:get-slot-value binding 'mysql-bind 'length) 0)
     (cond
      ((null value)
       (when (is-null-ptr stmt)
-       (setf (uffi:deref-array (is-null-ptr stmt) '(:array :byte) (1- position)) 1)))
+        (setf (uffi:deref-array (is-null-ptr stmt) '(:array :byte) (1- position)) 1)))
      (t
       (when (is-null-ptr stmt)
-       (setf (uffi:deref-array (is-null-ptr stmt) '(:array :byte) (1- position)) 0))
+        (setf (uffi:deref-array (is-null-ptr stmt) '(:array :byte) (1- position)) 0))
       (case type
-       (#.mysql-field-types#long
-        (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer) value))
-       (t
-        (warn "Unknown input bind type ~D." type))
-       )))))
+        (#.mysql-field-types#long
+         (setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer) value))
+        (t
+         (warn "Unknown input bind type ~D." type))
+        )))))
 
 #+mysql-client-v4.1
 (defmethod database-run-prepared ((stmt mysql-stmt))
   (when (input-bind stmt)
     (unless (zerop (mysql-stmt-bind-param (stmt stmt) (input-bind stmt)))
       (error 'sql-database-error
-            :error-id (mysql-stmt-errno (stmt stmt))
-            :message  (uffi:convert-from-cstring
-                       (mysql-stmt-error (stmt stmt))))))
+             :error-id (mysql-stmt-errno (stmt stmt))
+             :message  (uffi:convert-from-cstring
+                        (mysql-stmt-error (stmt stmt))))))
   (print 'a2)
   (unless (zerop (mysql-stmt-execute (stmt stmt)))
     (error 'sql-database-error
-          :error-id (mysql-stmt-errno (stmt stmt))
-          :message  (uffi:convert-from-cstring
-                     (mysql-stmt-error (stmt stmt)))))
+           :error-id (mysql-stmt-errno (stmt stmt))
+           :message  (uffi:convert-from-cstring
+                      (mysql-stmt-error (stmt stmt)))))
   (print 'a3)
   (unless (zerop (mysql-stmt-store-result (stmt stmt)))
     (error 'sql-database-error
-          :error-id (mysql-stmt-errno (stmt stmt))
-          :message  (uffi:convert-from-cstring
-                     (mysql-stmt-error (stmt stmt)))))
+           :error-id (mysql-stmt-errno (stmt stmt))
+           :message  (uffi:convert-from-cstring
+                      (mysql-stmt-error (stmt stmt)))))
   (database-fetch-prepared-rows stmt))
 
 #+mysql-client-v4.1
       ((not (zerop rc)) (nreverse rows))
     (push
      (loop for i from 0 below num-fields
-          collect
-          (let ((is-null
-                 (not (zerop (uffi:ensure-char-integer
-                              (uffi:deref-array (is-null-ptr stmt) '(:array :byte) i))))))
-            (unless is-null
-              (let* ((bind (uffi:deref-array (output-bind stmt) '(:array mysql-bind) i))
-                     (type (uffi:get-slot-value bind 'mysql-bind 'mysql::buffer-type))
-                     (buffer (uffi:get-slot-value bind 'mysql-bind 'mysql::buffer)))
-                (case type
-                  ((#.mysql-field-types#var-string #.mysql-field-types#string
-                    #.mysql-field-types#tiny-blob #.mysql-field-types#blob
-                    #.mysql-field-types#medium-blob #.mysql-field-types#long-blob)
-                   (uffi:convert-from-foreign-string buffer))
-                   (#.mysql-field-types#tiny
-                    (uffi:ensure-char-integer
-                     (uffi:deref-pointer buffer :byte)))
-                   (#.mysql-field-types#short
-                    (uffi:deref-pointer buffer :short))
-                   (#.mysql-field-types#long
-                    (uffi:deref-pointer buffer :int))
-                   #+64bit
-                   (#.mysql-field-types#longlong
-                    (uffi:deref-pointer buffer :long))
-                   (#.mysql-field-types#float
-                    (uffi:deref-pointer buffer :float))
-                   (#.mysql-field-types#double
-                    (uffi:deref-pointer buffer :double))
-                  ((#.mysql-field-types#time #.mysql-field-types#date
-                                             #.mysql-field-types#datetime #.mysql-field-types#timestamp)
-                   (let ((year (uffi:get-slot-value buffer 'mysql-time 'mysql::year))
-                         (month (uffi:get-slot-value buffer 'mysql-time 'mysql::month))
-                         (day (uffi:get-slot-value buffer 'mysql-time 'mysql::day))
-                         (hour (uffi:get-slot-value buffer 'mysql-time 'mysql::hour))
-                         (minute (uffi:get-slot-value buffer 'mysql-time 'mysql::minute))
-                 (second (uffi:get-slot-value buffer 'mysql-time 'mysql::second)))
-                     (db-timestring
-                      (make-time :year year :month month :day day :hour hour
-                                 :minute minute :second second))))
-                  (t
-                   (list type)))))))
+           collect
+           (let ((is-null
+                  (not (zerop (uffi:ensure-char-integer
+                               (uffi:deref-array (is-null-ptr stmt) '(:array :byte) i))))))
+             (unless is-null
+               (let* ((bind (uffi:deref-array (output-bind stmt) '(:array mysql-bind) i))
+                      (type (uffi:get-slot-value bind 'mysql-bind 'mysql::buffer-type))
+                      (buffer (uffi:get-slot-value bind 'mysql-bind 'mysql::buffer)))
+                 (case type
+                   ((#.mysql-field-types#var-string #.mysql-field-types#string
+                     #.mysql-field-types#tiny-blob #.mysql-field-types#blob
+                     #.mysql-field-types#medium-blob #.mysql-field-types#long-blob)
+                    (uffi:convert-from-foreign-string buffer))
+                    (#.mysql-field-types#tiny
+                     (uffi:ensure-char-integer
+                      (uffi:deref-pointer buffer :byte)))
+                    (#.mysql-field-types#short
+                     (uffi:deref-pointer buffer :short))
+                    (#.mysql-field-types#long
+                     (uffi:deref-pointer buffer :int))
+                    #+64bit
+                    (#.mysql-field-types#longlong
+                     (uffi:deref-pointer buffer :long))
+                    (#.mysql-field-types#float
+                     (uffi:deref-pointer buffer :float))
+                    (#.mysql-field-types#double
+                     (uffi:deref-pointer buffer :double))
+                   ((#.mysql-field-types#time #.mysql-field-types#date
+                                              #.mysql-field-types#datetime #.mysql-field-types#timestamp)
+                    (let ((year (uffi:get-slot-value buffer 'mysql-time 'mysql::year))
+                          (month (uffi:get-slot-value buffer 'mysql-time 'mysql::month))
+                          (day (uffi:get-slot-value buffer 'mysql-time 'mysql::day))
+                          (hour (uffi:get-slot-value buffer 'mysql-time 'mysql::hour))
+                          (minute (uffi:get-slot-value buffer 'mysql-time 'mysql::minute))
+                  (second (uffi:get-slot-value buffer 'mysql-time 'mysql::second)))
+                      (db-timestring
+                       (make-time :year year :month month :day day :hour hour
+                                  :minute minute :second second))))
+                   (t
+                    (list type)))))))
      rows)))
 
 
index 60dfd92..3aac6f9 100644 (file)
@@ -1,10 +1,10 @@
 (in-package :mysql)
 
-#+lispworks 
+#+lispworks
 (progn
   (setq c (fli:allocate-foreign-object :type 'mysql-mysql))
   (format t "~&Size MYSQL structure: ~d" (fli:pointer-element-size c)))
-#+allegro 
+#+allegro
 (progn
   (setq c (ff:allocate-fobject 'mysql-mysql :foreign))
   (format t "~&Size MYSQL structure: ~A" c))
index 4719d73..50ef443 100644 (file)
@@ -45,14 +45,14 @@ as possible second argument) to the desired representation of date/time/timestam
     `(let ((,size (length ,string)))
        (when (and ,max-length (> ,size ,max-length))
          (error 'clsql:sql-database-data-error
-               :message
-               (format nil "string \"~a\" of length ~d is longer than max-length: ~d"
-                       ,string ,size ,max-length)))
+                :message
+                (format nil "string \"~a\" of length ~d is longer than max-length: ~d"
+                        ,string ,size ,max-length)))
       (with-cast-pointer (char-ptr ,ptr :byte)
-       (dotimes (i ,size)
-         (setf (deref-array char-ptr '(:array :byte) i)
-               (char-code (char ,string i))))
-       (setf (deref-array char-ptr '(:array :byte) ,size) 0)))))
+        (dotimes (i ,size)
+          (setf (deref-array char-ptr '(:array :byte) i)
+                (char-code (char ,string i))))
+        (setf (deref-array char-ptr '(:array :byte) ,size) 0)))))
 
 (defun %cstring-into-vector (ptr vector offset size-in-bytes)
   (dotimes (i size-in-bytes)
@@ -64,36 +64,36 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun handle-error (henv hdbc hstmt)
   (let ((sql-state (allocate-foreign-string 256))
-       (error-message (allocate-foreign-string #.$SQL_MAX_MESSAGE_LENGTH)))
+        (error-message (allocate-foreign-string #.$SQL_MAX_MESSAGE_LENGTH)))
     (with-foreign-objects ((error-code #.$ODBC-LONG-TYPE)
-                          (msg-length :short))
+                           (msg-length :short))
       (SQLError henv hdbc hstmt sql-state
-               error-code error-message
-               #.$SQL_MAX_MESSAGE_LENGTH msg-length)
+                error-code error-message
+                #.$SQL_MAX_MESSAGE_LENGTH msg-length)
       (let ((err (convert-from-foreign-string error-message))
-           (state (convert-from-foreign-string sql-state)))
-       (free-foreign-object error-message)
-       (free-foreign-object sql-state)
-       (values
-        err
-        state
-        (deref-pointer msg-length :short)
-        (deref-pointer error-code #.$ODBC-LONG-TYPE))))))
+            (state (convert-from-foreign-string sql-state)))
+        (free-foreign-object error-message)
+        (free-foreign-object sql-state)
+        (values
+         err
+         state
+         (deref-pointer msg-length :short)
+         (deref-pointer error-code #.$ODBC-LONG-TYPE))))))
 
 (defun sql-state (henv hdbc hstmt)
   (let ((sql-state (allocate-foreign-string 256))
-       (error-message (allocate-foreign-string #.$SQL_MAX_MESSAGE_LENGTH)))
+        (error-message (allocate-foreign-string #.$SQL_MAX_MESSAGE_LENGTH)))
     (with-foreign-objects ((error-code #.$ODBC-LONG-TYPE)
-                          (msg-length :short))
+                           (msg-length :short))
       (SQLError henv hdbc hstmt sql-state error-code
-               error-message #.$SQL_MAX_MESSAGE_LENGTH msg-length)
+                error-message #.$SQL_MAX_MESSAGE_LENGTH msg-length)
       (let ((state (convert-from-foreign-string sql-state)))
-       (free-foreign-object error-message)
-       (free-foreign-object sql-state)
-       state
-       ;; test this: return a keyword for efficiency
-       ;;(%cstring-to-keyword state)
-       ))))
+        (free-foreign-object error-message)
+        (free-foreign-object sql-state)
+        state
+        ;; test this: return a keyword for efficiency
+        ;;(%cstring-to-keyword state)
+        ))))
 
 (defmacro with-error-handling ((&key henv hdbc hstmt (print-info t))
                                    odbc-call &body body)
@@ -116,53 +116,53 @@ as possible second argument) to the desired representation of date/time/timestam
          (#.$SQL_SUCCESS_WITH_INFO
           (when ,print-info
             (multiple-value-bind (error-message sql-state)
-               (handle-error (or ,henv +null-handle-ptr+)
-                             (or ,hdbc +null-handle-ptr+)
-                             (or ,hstmt +null-handle-ptr+))
-             (when *info-output*
-               (format *info-output* "[ODBC info ~A] ~A state: ~A"
-                       ,result-code error-message
-                       sql-state))))
+                (handle-error (or ,henv +null-handle-ptr+)
+                              (or ,hdbc +null-handle-ptr+)
+                              (or ,hstmt +null-handle-ptr+))
+              (when *info-output*
+                (format *info-output* "[ODBC info ~A] ~A state: ~A"
+                        ,result-code error-message
+                        sql-state))))
           (progn ,result-code ,@body))
          (#.$SQL_INVALID_HANDLE
           (error
-          'clsql-sys:sql-database-error
-          :message "ODBC: Invalid handle"))
+           'clsql-sys:sql-database-error
+           :message "ODBC: Invalid handle"))
          (#.$SQL_STILL_EXECUTING
           (error
-          'clsql-sys:sql-temporary-error
-          :message "ODBC: Still executing"))
+           'clsql-sys:sql-temporary-error
+           :message "ODBC: Still executing"))
          (#.$SQL_ERROR
           (multiple-value-bind (error-message sql-state)
-             (handle-error (or ,henv +null-handle-ptr+)
-                           (or ,hdbc +null-handle-ptr+)
-                           (or ,hstmt +null-handle-ptr+))
+              (handle-error (or ,henv +null-handle-ptr+)
+                            (or ,hdbc +null-handle-ptr+)
+                            (or ,hstmt +null-handle-ptr+))
             (error
-            'clsql-sys:sql-database-error
-            :message error-message
-            :secondary-error-id sql-state)))
-        (#.$SQL_NO_DATA_FOUND
-         (progn ,result-code ,@body))
-        ;; work-around for Allegro 7.0beta AMD64 which returns negative numbers
-        (otherwise
-         (multiple-value-bind (error-message sql-state)
-             (handle-error (or ,henv +null-handle-ptr+)
-                           (or ,hdbc +null-handle-ptr+)
-                           (or ,hstmt +null-handle-ptr+))
+             'clsql-sys:sql-database-error
+             :message error-message
+             :secondary-error-id sql-state)))
+         (#.$SQL_NO_DATA_FOUND
+          (progn ,result-code ,@body))
+         ;; work-around for Allegro 7.0beta AMD64 which returns negative numbers
+         (otherwise
+          (multiple-value-bind (error-message sql-state)
+              (handle-error (or ,henv +null-handle-ptr+)
+                            (or ,hdbc +null-handle-ptr+)
+                            (or ,hstmt +null-handle-ptr+))
             (error
-            'clsql-sys:sql-database-error
-            :message error-message
-            :secondary-error-id sql-state))
-         #+ignore
+             'clsql-sys:sql-database-error
+             :message error-message
+             :secondary-error-id sql-state))
+          #+ignore
           (progn ,result-code ,@body))))))
 
 (defun %new-environment-handle ()
   (let ((henv
-        (with-foreign-object (phenv 'sql-handle)
-          (with-error-handling
-              ()
-            (SQLAllocHandle $SQL_HANDLE_ENV +null-handle-ptr+ phenv)
-            (deref-pointer phenv 'sql-handle)))))
+         (with-foreign-object (phenv 'sql-handle)
+           (with-error-handling
+               ()
+             (SQLAllocHandle $SQL_HANDLE_ENV +null-handle-ptr+ phenv)
+             (deref-pointer phenv 'sql-handle)))))
     (%set-attr-odbc-version henv $SQL_OV_ODBC3)
     henv))
 
@@ -201,12 +201,12 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %sql-connect (hdbc server uid pwd)
   (with-cstrings ((server-ptr server)
-                 (uid-ptr uid)
-                 (pwd-ptr pwd))
+                  (uid-ptr uid)
+                  (pwd-ptr pwd))
     (with-error-handling
-       (:hdbc hdbc)
+        (:hdbc hdbc)
       (SQLConnect hdbc server-ptr $SQL_NTS uid-ptr
-                 $SQL_NTS pwd-ptr $SQL_NTS))))
+                  $SQL_NTS pwd-ptr $SQL_NTS))))
 
 (defun %sql-driver-connect (hdbc connection-string completion window-handle)
   (with-cstring (connection-ptr connection-string)
@@ -273,14 +273,14 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %new-statement-handle (hdbc)
   (let ((statement-handle
-        (with-foreign-object (phstmt 'sql-handle)
-          (with-error-handling
-              (:hdbc hdbc)
-            (SQLAllocHandle $SQL_HANDLE_STMT hdbc phstmt)
-            (deref-pointer phstmt 'sql-handle)))))
+         (with-foreign-object (phstmt 'sql-handle)
+           (with-error-handling
+               (:hdbc hdbc)
+             (SQLAllocHandle $SQL_HANDLE_STMT hdbc phstmt)
+             (deref-pointer phstmt 'sql-handle)))))
     (if (uffi:null-pointer-p statement-handle)
-       (error 'clsql:sql-database-error :message "Received null statement handle.")
-       statement-handle)))
+        (error 'clsql:sql-database-error :message "Received null statement handle.")
+        statement-handle)))
 
 (defun %sql-get-info (hdbc info-type)
   (ecase info-type
@@ -320,12 +320,12 @@ as possible second argument) to the desired representation of date/time/timestam
       #.$SQL_USER_NAME)
      (let ((info-ptr (allocate-foreign-string 1024)))
        (with-foreign-object (info-length-ptr :short)
-        (with-error-handling
-            (:hdbc hdbc)
-            (SQLGetInfo hdbc info-type info-ptr 1023 info-length-ptr)
-          (let ((info (convert-from-foreign-string info-ptr)))
-            (free-foreign-object info-ptr)
-            info)))))
+         (with-error-handling
+             (:hdbc hdbc)
+             (SQLGetInfo hdbc info-type info-ptr 1023 info-length-ptr)
+           (let ((info (convert-from-foreign-string info-ptr)))
+             (free-foreign-object info-ptr)
+             info)))))
     ;; those returning a word
     ((#.$SQL_ACTIVE_CONNECTIONS
       #.$SQL_ACTIVE_STATEMENTS
@@ -355,14 +355,14 @@ as possible second argument) to the desired representation of date/time/timestam
       #.$SQL_QUOTED_IDENTIFIER_CASE
       #.$SQL_TXN_CAPABLE)
      (with-foreign-objects ((info-ptr :short)
-                           (info-length-ptr :short))
+                            (info-length-ptr :short))
        (with-error-handling
-       (:hdbc hdbc)
+        (:hdbc hdbc)
          (SQLGetInfo hdbc
-                    info-type
-                    info-ptr
-                    255
-                    info-length-ptr)
+                     info-type
+                     info-ptr
+                     255
+                     info-length-ptr)
          (deref-pointer info-ptr :short)))
      )
     ;; those returning a long bitmask
@@ -412,14 +412,14 @@ as possible second argument) to the desired representation of date/time/timestam
       #.$SQL_TXN_ISOLATION_OPTION
       #.$SQL_UNION)
      (with-foreign-objects ((info-ptr #.$ODBC-LONG-TYPE)
-                           (info-length-ptr :short))
+                            (info-length-ptr :short))
        (with-error-handling
          (:hdbc hdbc)
          (SQLGetInfo hdbc
-                    info-type
-                    info-ptr
-                    255
-                    info-length-ptr)
+                     info-type
+                     info-ptr
+                     255
+                     info-length-ptr)
          (deref-pointer info-ptr #.$ODBC-LONG-TYPE)))
      )
     ;; those returning a long integer
@@ -435,7 +435,7 @@ as possible second argument) to the desired representation of date/time/timestam
       #.$SQL_ACTIVE_ENVIRONMENTS
       )
      (with-foreign-objects ((info-ptr #.$ODBC-LONG-TYPE)
-                           (info-length-ptr :short))
+                            (info-length-ptr :short))
        (with-error-handling
          (:hdbc hdbc)
          (SQLGetInfo hdbc info-type info-ptr 255 info-length-ptr)
@@ -473,38 +473,38 @@ as possible second argument) to the desired representation of date/time/timestam
 (defun %describe-column (hstmt column-nr)
   (let ((column-name-ptr (allocate-foreign-string 256)))
     (with-foreign-objects ((column-name-length-ptr :short)
-                          (column-sql-type-ptr :short)
-                          (column-precision-ptr #.$ODBC-ULONG-TYPE)
-                          (column-scale-ptr :short)
-                          (column-nullable-p-ptr :short))
+                           (column-sql-type-ptr :short)
+                           (column-precision-ptr #.$ODBC-ULONG-TYPE)
+                           (column-scale-ptr :short)
+                           (column-nullable-p-ptr :short))
       (with-error-handling (:hstmt hstmt)
-         (SQLDescribeCol hstmt column-nr column-name-ptr 256
-                         column-name-length-ptr
-                         column-sql-type-ptr
-                         column-precision-ptr
-                         column-scale-ptr
-                         column-nullable-p-ptr)
-       (let ((column-name (convert-from-foreign-string column-name-ptr)))
-         (free-foreign-object column-name-ptr)
-         (values
-          column-name
-          (deref-pointer column-sql-type-ptr :short)
-          (deref-pointer column-precision-ptr #.$ODBC-ULONG-TYPE)
-          (deref-pointer column-scale-ptr :short)
-          (deref-pointer column-nullable-p-ptr :short)))))))
+          (SQLDescribeCol hstmt column-nr column-name-ptr 256
+                          column-name-length-ptr
+                          column-sql-type-ptr
+                          column-precision-ptr
+                          column-scale-ptr
+                          column-nullable-p-ptr)
+        (let ((column-name (convert-from-foreign-string column-name-ptr)))
+          (free-foreign-object column-name-ptr)
+          (values
+           column-name
+           (deref-pointer column-sql-type-ptr :short)
+           (deref-pointer column-precision-ptr #.$ODBC-ULONG-TYPE)
+           (deref-pointer column-scale-ptr :short)
+           (deref-pointer column-nullable-p-ptr :short)))))))
 
 ;; parameter counting is 1-based
 (defun %describe-parameter (hstmt parameter-nr)
   (with-foreign-objects ((column-sql-type-ptr :short)
-                        (column-precision-ptr #.$ODBC-ULONG-TYPE)
-                        (column-scale-ptr :short)
-                        (column-nullable-p-ptr :short))
+                         (column-precision-ptr #.$ODBC-ULONG-TYPE)
+                         (column-scale-ptr :short)
+                         (column-nullable-p-ptr :short))
     (with-error-handling
       (:hstmt hstmt)
       (SQLDescribeParam hstmt parameter-nr
-                       column-sql-type-ptr
+                        column-sql-type-ptr
                         column-precision-ptr
-                       column-scale-ptr
+                        column-scale-ptr
                         column-nullable-p-ptr)
       (values
        (deref-pointer column-sql-type-ptr :short)
@@ -515,34 +515,34 @@ as possible second argument) to the desired representation of date/time/timestam
 (defun %column-attributes (hstmt column-nr descriptor-type)
   (let ((descriptor-info-ptr (allocate-foreign-string 256)))
     (with-foreign-objects ((descriptor-length-ptr :short)
-                          (numeric-descriptor-ptr #.$ODBC-LONG-TYPE))
+                           (numeric-descriptor-ptr #.$ODBC-LONG-TYPE))
       (with-error-handling
-         (:hstmt hstmt)
-         (SQLColAttributes hstmt column-nr descriptor-type descriptor-info-ptr
-                           256 descriptor-length-ptr
-                           numeric-descriptor-ptr)
-       (let ((desc (convert-from-foreign-string descriptor-info-ptr)))
-         (free-foreign-object descriptor-info-ptr)
-         (values
-          desc
-          (deref-pointer numeric-descriptor-ptr #.$ODBC-LONG-TYPE)))))))
+          (:hstmt hstmt)
+          (SQLColAttributes hstmt column-nr descriptor-type descriptor-info-ptr
+                            256 descriptor-length-ptr
+                            numeric-descriptor-ptr)
+        (let ((desc (convert-from-foreign-string descriptor-info-ptr)))
+          (free-foreign-object descriptor-info-ptr)
+          (values
+           desc
+           (deref-pointer numeric-descriptor-ptr #.$ODBC-LONG-TYPE)))))))
 
 (defun %prepare-describe-columns (hstmt table-qualifier table-owner
                                    table-name column-name)
   (with-cstrings ((table-qualifier-ptr table-qualifier)
-                 (table-owner-ptr table-owner)
-                 (table-name-ptr table-name)
-                 (column-name-ptr column-name))
+                  (table-owner-ptr table-owner)
+                  (table-name-ptr table-name)
+                  (column-name-ptr column-name))
     (with-error-handling
-       (:hstmt hstmt)
+        (:hstmt hstmt)
       (SQLColumns hstmt
-                 table-qualifier-ptr (length table-qualifier)
-                 table-owner-ptr (length table-owner)
-                 table-name-ptr (length table-name)
-                 column-name-ptr (length column-name)))))
+                  table-qualifier-ptr (length table-qualifier)
+                  table-owner-ptr (length table-owner)
+                  table-name-ptr (length table-name)
+                  column-name-ptr (length column-name)))))
 
 (defun %describe-columns (hdbc table-qualifier table-owner
-                         table-name column-name)
+                          table-name column-name)
   (with-statement-handle (hstmt hdbc)
     (%prepare-describe-columns hstmt table-qualifier table-owner
                                table-name column-name)
@@ -550,34 +550,34 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %sql-data-sources (henv &key (direction :first))
   (let ((name-ptr (allocate-foreign-string (1+ $SQL_MAX_DSN_LENGTH)))
-       (description-ptr (allocate-foreign-string 1024)))
+        (description-ptr (allocate-foreign-string 1024)))
     (with-foreign-objects ((name-length-ptr :short)
-                          (description-length-ptr :short))
+                           (description-length-ptr :short))
       (let ((res (with-error-handling
-                    (:henv henv)
-                    (SQLDataSources henv
-                                    (ecase direction
-                                      (:first $SQL_FETCH_FIRST)
-                                      (:next $SQL_FETCH_NEXT))
-                                    name-ptr
-                                    (1+ $SQL_MAX_DSN_LENGTH)
-                                    name-length-ptr
-                                    description-ptr
-                                    1024
-                                    description-length-ptr))))
-       (cond
-         ((= res $SQL_NO_DATA_FOUND)
-          (let ((name (convert-from-foreign-string name-ptr))
-                (desc (convert-from-foreign-string description-ptr)))
-            (free-foreign-object name-ptr)
-            (free-foreign-object description-ptr)
-            (values
-             name
-             desc)))
-         (t
-          (free-foreign-object name-ptr)
-          (free-foreign-object description-ptr)
-          nil))))))
+                     (:henv henv)
+                     (SQLDataSources henv
+                                     (ecase direction
+                                       (:first $SQL_FETCH_FIRST)
+                                       (:next $SQL_FETCH_NEXT))
+                                     name-ptr
+                                     (1+ $SQL_MAX_DSN_LENGTH)
+                                     name-length-ptr
+                                     description-ptr
+                                     1024
+                                     description-length-ptr))))
+        (cond
+          ((= res $SQL_NO_DATA_FOUND)
+           (let ((name (convert-from-foreign-string name-ptr))
+                 (desc (convert-from-foreign-string description-ptr)))
+             (free-foreign-object name-ptr)
+             (free-foreign-object description-ptr)
+             (values
+              name
+              desc)))
+          (t
+           (free-foreign-object name-ptr)
+           (free-foreign-object description-ptr)
+           nil))))))
 
 
 
@@ -642,77 +642,77 @@ as possible second argument) to the desired representation of date/time/timestam
     (ecase format
       (:unsigned-byte-vector
        (let ((vector (make-array len :element-type '(unsigned-byte 8))))
-        (dotimes (i len)
-          (setf (aref vector i)
-                (deref-array casted '(:array :byte) i)))
-        vector))
+         (dotimes (i len)
+           (setf (aref vector i)
+                 (deref-array casted '(:array :byte) i)))
+         vector))
       (:bit-vector
        (let ((vector (make-array (ash len 3) :element-type 'bit)))
-        (dotimes (i len)
-          (let ((byte (deref-array casted '(:array :byte) i)))
-            (dotimes (j 8)
-              (setf (bit vector (+ (ash i 3) j))
-                    (logand (ash byte (- j 7)) 1)))))
-        vector)))))
+         (dotimes (i len)
+           (let ((byte (deref-array casted '(:array :byte) i)))
+             (dotimes (j 8)
+               (setf (bit vector (+ (ash i 3) j))
+                     (logand (ash byte (- j 7)) 1)))))
+         vector)))))
 
 
 (defun read-data (data-ptr c-type sql-type out-len-ptr result-type)
   (declare (type long-ptr-type out-len-ptr))
   (let* ((out-len (deref-pointer out-len-ptr #.$ODBC-LONG-TYPE))
-        (value
-         (cond ((= out-len $SQL_NULL_DATA)
-                *null*)
-               (t
-                (case sql-type
-                  ;; SQL extended datatypes
+         (value
+          (cond ((= out-len $SQL_NULL_DATA)
+                 *null*)
+                (t
+                 (case sql-type
+                   ;; SQL extended datatypes
                    (#.$SQL_TINYINT  (get-cast-byte data-ptr))
-                  (#.$SQL_C_STINYINT (get-cast-byte data-ptr)) ;; ?
-                  (#.$SQL_C_SSHORT (get-cast-short data-ptr)) ;; ?
-                  (#.$SQL_SMALLINT (get-cast-short data-ptr)) ;; ??
-                  (#.$SQL_INTEGER (get-cast-int data-ptr))
-                  (#.$SQL_BIGINT (read-from-string
-                                  (get-cast-foreign-string data-ptr)))
-                  (#.$SQL_DECIMAL
-                   (let ((*read-base* 10))
-                     (read-from-string (get-cast-foreign-string data-ptr))))
+                   (#.$SQL_C_STINYINT (get-cast-byte data-ptr)) ;; ?
+                   (#.$SQL_C_SSHORT (get-cast-short data-ptr)) ;; ?
+                   (#.$SQL_SMALLINT (get-cast-short data-ptr)) ;; ??
+                   (#.$SQL_INTEGER (get-cast-int data-ptr))
+                   (#.$SQL_BIGINT (read-from-string
+                                   (get-cast-foreign-string data-ptr)))
+                   (#.$SQL_DECIMAL
+                    (let ((*read-base* 10))
+                      (read-from-string (get-cast-foreign-string data-ptr))))
                    (#.$SQL_BIT (get-cast-byte data-ptr))
-                  (t
-                   (case c-type
-                     ((#.$SQL_C_DATE #.$SQL_C_TYPE_DATE)
-                      (funcall *time-conversion-function* (date-to-universal-time data-ptr)))
-                     ((#.$SQL_C_TIME #.$SQL_C_TYPE_TIME)
-                      (multiple-value-bind (universal-time frac) (time-to-universal-time data-ptr)
-                        (funcall *time-conversion-function* universal-time frac)))
-                     ((#.$SQL_C_TIMESTAMP #.$SQL_C_TYPE_TIMESTAMP)
-                      (multiple-value-bind (universal-time frac) (timestamp-to-universal-time data-ptr)
-                        (funcall *time-conversion-function* universal-time frac)))
-                     (#.$SQL_INTEGER
-                      (get-cast-int data-ptr))
-                     (#.$SQL_C_FLOAT
-                      (get-cast-single-float data-ptr))
-                     (#.$SQL_C_DOUBLE
-                      (get-cast-double-float data-ptr))
-                     (#.$SQL_C_SLONG
-                      (get-cast-long data-ptr))
-                     #+lispworks
-                     (#.$SQL_C_BIT     ; encountered only in Access
-                      (get-cast-byte data-ptr))
-                     (#.$SQL_C_BINARY
-                      (get-cast-binary data-ptr out-len *binary-format*))
-                     ((#.$SQL_C_SSHORT #.$SQL_C_STINYINT) ; LMH short ints
-                      (get-cast-short data-ptr)) ; LMH
-                     #+ignore
-                     (#.$SQL_C_CHAR
-                      (code-char (get-cast-short data-ptr)))
-                     (t
-                      (get-cast-foreign-string data-ptr)))))))))
+                   (t
+                    (case c-type
+                      ((#.$SQL_C_DATE #.$SQL_C_TYPE_DATE)
+                       (funcall *time-conversion-function* (date-to-universal-time data-ptr)))
+                      ((#.$SQL_C_TIME #.$SQL_C_TYPE_TIME)
+                       (multiple-value-bind (universal-time frac) (time-to-universal-time data-ptr)
+                         (funcall *time-conversion-function* universal-time frac)))
+                      ((#.$SQL_C_TIMESTAMP #.$SQL_C_TYPE_TIMESTAMP)
+                       (multiple-value-bind (universal-time frac) (timestamp-to-universal-time data-ptr)
+                         (funcall *time-conversion-function* universal-time frac)))
+                      (#.$SQL_INTEGER
+                       (get-cast-int data-ptr))
+                      (#.$SQL_C_FLOAT
+                       (get-cast-single-float data-ptr))
+                      (#.$SQL_C_DOUBLE
+                       (get-cast-double-float data-ptr))
+                      (#.$SQL_C_SLONG
+                       (get-cast-long data-ptr))
+                      #+lispworks
+                      (#.$SQL_C_BIT     ; encountered only in Access
+                       (get-cast-byte data-ptr))
+                      (#.$SQL_C_BINARY
+                       (get-cast-binary data-ptr out-len *binary-format*))
+                      ((#.$SQL_C_SSHORT #.$SQL_C_STINYINT) ; LMH short ints
+                       (get-cast-short data-ptr)) ; LMH
+                      #+ignore
+                      (#.$SQL_C_CHAR
+                       (code-char (get-cast-short data-ptr)))
+                      (t
+                       (get-cast-foreign-string data-ptr)))))))))
 
     ;; FIXME: this could be better optimized for types which use READ-FROM-STRING above
 
     (if (and (or (eq result-type t) (eq result-type :string))
-            value
-            (not (stringp value)))
-       (write-to-string value)
+             value
+             (not (stringp value)))
+        (write-to-string value)
       value)))
 
 ;; which value is appropriate?
@@ -736,7 +736,7 @@ as possible second argument) to the desired representation of date/time/timestam
             ((#.$SQL_C_DATE #.$SQL_C_TYPE_DATE) (allocate-foreign-object 'sql-c-date))
             ((#.$SQL_C_TIME #.$SQL_C_TYPE_TIME) (allocate-foreign-object 'sql-c-time))
             ((#.$SQL_C_TIMESTAMP #.$SQL_C_TYPE_TIMESTAMP) (allocate-foreign-object 'sql-c-timestamp))
-           (#.$SQL_C_FLOAT (uffi:allocate-foreign-object :float))
+            (#.$SQL_C_FLOAT (uffi:allocate-foreign-object :float))
             (#.$SQL_C_DOUBLE (uffi:allocate-foreign-object :double))
             (#.$SQL_C_BIT (uffi:allocate-foreign-object :byte))
             (#.$SQL_C_STINYINT (uffi:allocate-foreign-object :byte))
@@ -787,7 +787,7 @@ as possible second argument) to the desired representation of date/time/timestam
                (cond (flatp
                       (when (> column-count 1)
                         (error 'clsql:sql-database-error
-                              :message "If more than one column is to be fetched, flatp has to be nil."))
+                               :message "If more than one column is to be fetched, flatp has to be nil."))
                       (loop until (= (%sql-fetch hstmt) $SQL_NO_DATA_FOUND)
                             collect
                             (read-data (aref data-ptrs 0)
@@ -846,10 +846,10 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %sql-extended-fetch (hstmt fetch-type row)
   (with-foreign-objects ((row-count-ptr #.$ODBC-ULONG-TYPE)
-                        (row-status-ptr :short))
+                         (row-status-ptr :short))
     (with-error-handling (:hstmt hstmt)
       (SQLExtendedFetch hstmt fetch-type row row-count-ptr
-                       row-status-ptr)
+                        row-status-ptr)
       (values (deref-pointer row-count-ptr #.$ODBC-ULONG-TYPE)
               (deref-pointer row-status-ptr :short)))))
 
@@ -991,7 +991,7 @@ as possible second argument) to the desired representation of date/time/timestam
 (defun %set-attr-odbc-version (henv version)
   (with-error-handling (:henv henv)
       (SQLSetEnvAttr henv $SQL_ATTR_ODBC_VERSION
-                    (make-pointer version :void) 0)))
+                     (make-pointer version :void) 0)))
 
 (defun %list-tables (hstmt)
   (with-error-handling (:hstmt hstmt)
@@ -1010,32 +1010,32 @@ as possible second argument) to the desired representation of date/time/timestam
 
 (defun %list-data-sources (henv)
   (let ((dsn (allocate-foreign-string (1+ $SQL_MAX_DSN_LENGTH)))
-       (desc (allocate-foreign-string 256))
-       (results nil))
+        (desc (allocate-foreign-string 256))
+        (results nil))
     (unwind-protect
-        (with-foreign-objects ((dsn-len :short)
-                               (desc-len :short))
-          (let ((res (with-error-handling (:henv henv)
-                       (SQLDataSources henv $SQL_FETCH_FIRST dsn
-                                       (1+ $SQL_MAX_DSN_LENGTH)
-                                       dsn-len desc 256 desc-len))))
-            (when (or (eql res $SQL_SUCCESS)
-                      (eql res $SQL_SUCCESS_WITH_INFO))
-              (push (convert-from-foreign-string dsn) results))
-
-            (do ((res (with-error-handling (:henv henv)
-                        (SQLDataSources henv $SQL_FETCH_NEXT dsn
-                                        (1+ $SQL_MAX_DSN_LENGTH)
-                                        dsn-len desc 256 desc-len))
-                      (with-error-handling (:henv henv)
-                        (SQLDataSources henv $SQL_FETCH_NEXT dsn
-                                        (1+ $SQL_MAX_DSN_LENGTH)
-                                        dsn-len desc 256 desc-len))))
-                ((not (or (eql res $SQL_SUCCESS)
-                          (eql res $SQL_SUCCESS_WITH_INFO))))
-              (push (convert-from-foreign-string dsn) results))))
+         (with-foreign-objects ((dsn-len :short)
+                                (desc-len :short))
+           (let ((res (with-error-handling (:henv henv)
+                        (SQLDataSources henv $SQL_FETCH_FIRST dsn
+                                        (1+ $SQL_MAX_DSN_LENGTH)
+                                        dsn-len desc 256 desc-len))))
+             (when (or (eql res $SQL_SUCCESS)
+                       (eql res $SQL_SUCCESS_WITH_INFO))
+               (push (convert-from-foreign-string dsn) results))
+
+             (do ((res (with-error-handling (:henv henv)
+                         (SQLDataSources henv $SQL_FETCH_NEXT dsn
+                                         (1+ $SQL_MAX_DSN_LENGTH)
+                                         dsn-len desc 256 desc-len))
+                       (with-error-handling (:henv henv)
+                         (SQLDataSources henv $SQL_FETCH_NEXT dsn
+                                         (1+ $SQL_MAX_DSN_LENGTH)
+                                         dsn-len desc 256 desc-len))))
+                 ((not (or (eql res $SQL_SUCCESS)
+                           (eql res $SQL_SUCCESS_WITH_INFO))))
+               (push (convert-from-foreign-string dsn) results))))
       (progn
-       (free-foreign-object dsn)
-       (free-foreign-object desc)))
+        (free-foreign-object dsn)
+        (free-foreign-object desc)))
     (nreverse results)))
 
index 6d8a183..4dfef88 100644 (file)
@@ -22,7 +22,7 @@
 (defconstant $ODBC-LONG-TYPE :int)
 (defconstant $ODBC-ULONG-TYPE :unsigned-int)
 
-;; (defconstant $ODBCVER       #x0210)
+;; (defconstant $ODBCVER        #x0210)
 
 
 ;; for new SQLAllocHandle functiion
 (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 
-(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_SPEC_MAJOR 2)         ;; Major version of specification
+(defconstant $SQL_SPEC_MINOR 10)        ;; Minor version of specification
+(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
 
 ;; RETCODEs
 (defconstant $SQL_INVALID_HANDLE -2)
 (defconstant $SQL_TYPE_NULL 0)
 (defconstant $SQL_TYPE_MAX $SQL_VARCHAR)
 
-;; C datatype to SQL datatype mapping  SQL types
+;; C datatype to SQL datatype mapping   SQL types
 
-(defconstant $SQL_C_CHAR $SQL_CHAR)            ;; CHAR, VARCHAR, DECIMAL, NUMERIC
-(defconstant $SQL_C_LONG $SQL_INTEGER)         ;; INTEGER 
-(defconstant $SQL_C_SHORT $SQL_SMALLINT)       ;; SMALLINT 
-(defconstant $SQL_C_FLOAT $SQL_REAL)           ;; REAL 
-(defconstant $SQL_C_DOUBLE $SQL_DOUBLE)                ;; FLOAT, DOUBLE
+(defconstant $SQL_C_CHAR $SQL_CHAR)             ;; CHAR, VARCHAR, DECIMAL, NUMERIC
+(defconstant $SQL_C_LONG $SQL_INTEGER)          ;; INTEGER
+(defconstant $SQL_C_SHORT $SQL_SMALLINT)        ;; SMALLINT
+(defconstant $SQL_C_FLOAT $SQL_REAL)            ;; REAL
+(defconstant $SQL_C_DOUBLE $SQL_DOUBLE)         ;; FLOAT, DOUBLE
 (defconstant $SQL_C_DEFAULT 99)
 
 ;; NULL status constants.  These are used in SQLColumns, SQLColAttributes,
 (defconstant $SQL_COLUMN_UNSIGNED 8)
 (defconstant $SQL_COLUMN_MONEY 9)
 (defconstant $SQL_COLUMN_UPDATABLE 10)
-(defconstant $SQL_COLUMN_AUTO_INCREMENT        11)
-(defconstant $SQL_COLUMN_CASE_SENSITIVE        12)
+(defconstant $SQL_COLUMN_AUTO_INCREMENT 11)
+(defconstant $SQL_COLUMN_CASE_SENSITIVE 12)
 (defconstant $SQL_COLUMN_SEARCHABLE 13)
 (defconstant $SQL_COLUMN_TYPE_NAME 14)
 (defconstant $SQL_COLUMN_TABLE_NAME 15)
 (defconstant $SQL_COLUMN_OWNER_NAME 16)
-(defconstant $SQL_COLUMN_QUALIFIER_NAME        17)
+(defconstant $SQL_COLUMN_QUALIFIER_NAME 17)
 (defconstant $SQL_COLUMN_LABEL 18)
 (defconstant $SQL_COLATT_OPT_MAX $SQL_COLUMN_LABEL)
 
 (defconstant $SQL_ATTR_READWRITE_UNKNOWN 2)
 
 ;; SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE
-;; These are also used by SQLGetInfo                    
+;; These are also used by SQLGetInfo
 (defconstant $SQL_UNSEARCHABLE 0)
 (defconstant $SQL_LIKE_ONLY 1)
 (defconstant $SQL_ALL_EXCEPT_LIKE 2)
 (defconstant $SQL_API_SQLSETSCROLLOPTIONS 69)
 (defconstant $SQL_API_SQLTABLEPRIVILEGES  70)
 
-;/*            SDK 2.0 Additions               */
+;/*             SDK 2.0 Additions               */
 (defconstant $SQL_API_SQLDRIVERS 71)
-(defconstant $SQL_API_SQLBINDPARAMETER 72)
+(defconstant $SQL_API_SQLBINDPARAMETER  72)
 (defconstant $SQL_EXT_API_LAST $SQL_API_SQLBINDPARAMETER)
 
 (defconstant $SQL_API_ALL_FUNCTIONS 0)
 (defconstant $SQL_NON_NULLABLE_COLUMNS 75)
 
 ;;; ODBC SDK 2.0 Additions
-(defconstant $SQL_DRIVER_HLIB                  76)
-(defconstant $SQL_DRIVER_ODBC_VER              77)
-(defconstant $SQL_LOCK_TYPES                   78)
-(defconstant $SQL_POS_OPERATIONS               79)
-(defconstant $SQL_POSITIONED_STATEMENTS                80)
-(defconstant $SQL_GETDATA_EXTENSIONS           81)
-(defconstant $SQL_BOOKMARK_PERSISTENCE         82)
-(defconstant $SQL_STATIC_SENSITIVITY           83)
-(defconstant $SQL_FILE_USAGE                   84)
-(defconstant $SQL_NULL_COLLATION               85)
-(defconstant $SQL_ALTER_TABLE                  86)
-(defconstant $SQL_COLUMN_ALIAS                 87)
-(defconstant $SQL_GROUP_BY                     88)
-(defconstant $SQL_KEYWORDS                     89)
-(defconstant $SQL_ORDER_BY_COLUMNS_IN_SELECT   90)
-(defconstant $SQL_OWNER_USAGE                  91)
-(defconstant $SQL_QUALIFIER_USAGE              92)
-(defconstant $SQL_QUOTED_IDENTIFIER_CASE       93)
-(defconstant $SQL_SPECIAL_CHARACTERS           94)
-(defconstant $SQL_SUBQUERIES                   95)
-(defconstant $SQL_UNION                                96)
-(defconstant $SQL_MAX_COLUMNS_IN_GROUP_BY      97)
-(defconstant $SQL_MAX_COLUMNS_IN_INDEX         98)
-(defconstant $SQL_MAX_COLUMNS_IN_ORDER_BY      99)
-(defconstant $SQL_MAX_COLUMNS_IN_SELECT               100)
-(defconstant $SQL_MAX_COLUMNS_IN_TABLE            101)
-(defconstant $SQL_MAX_INDEX_SIZE                                  102)
-(defconstant $SQL_MAX_ROW_SIZE_INCLUDES_LONG      103)
-(defconstant $SQL_MAX_ROW_SIZE                            104)
-(defconstant $SQL_MAX_STATEMENT_LEN                       105)
+(defconstant $SQL_DRIVER_HLIB                   76)
+(defconstant $SQL_DRIVER_ODBC_VER               77)
+(defconstant $SQL_LOCK_TYPES                    78)
+(defconstant $SQL_POS_OPERATIONS                79)
+(defconstant $SQL_POSITIONED_STATEMENTS         80)
+(defconstant $SQL_GETDATA_EXTENSIONS            81)
+(defconstant $SQL_BOOKMARK_PERSISTENCE          82)
+(defconstant $SQL_STATIC_SENSITIVITY            83)
+(defconstant $SQL_FILE_USAGE                    84)
+(defconstant $SQL_NULL_COLLATION                85)
+(defconstant $SQL_ALTER_TABLE                   86)
+(defconstant $SQL_COLUMN_ALIAS                  87)
+(defconstant $SQL_GROUP_BY                      88)
+(defconstant $SQL_KEYWORDS                      89)
+(defconstant $SQL_ORDER_BY_COLUMNS_IN_SELECT    90)
+(defconstant $SQL_OWNER_USAGE                   91)
+(defconstant $SQL_QUALIFIER_USAGE               92)
+(defconstant $SQL_QUOTED_IDENTIFIER_CASE        93)
+(defconstant $SQL_SPECIAL_CHARACTERS            94)
+(defconstant $SQL_SUBQUERIES                    95)
+(defconstant $SQL_UNION                         96)
+(defconstant $SQL_MAX_COLUMNS_IN_GROUP_BY       97)
+(defconstant $SQL_MAX_COLUMNS_IN_INDEX          98)
+(defconstant $SQL_MAX_COLUMNS_IN_ORDER_BY       99)
+(defconstant $SQL_MAX_COLUMNS_IN_SELECT        100)
+(defconstant $SQL_MAX_COLUMNS_IN_TABLE             101)
+(defconstant $SQL_MAX_INDEX_SIZE                                   102)
+(defconstant $SQL_MAX_ROW_SIZE_INCLUDES_LONG       103)
+(defconstant $SQL_MAX_ROW_SIZE                             104)
+(defconstant $SQL_MAX_STATEMENT_LEN                        105)
 (defconstant $SQL_MAX_TABLES_IN_SELECT 106)
 (defconstant $SQL_MAX_USER_NAME_LEN 107)
 (defconstant $SQL_MAX_CHAR_LITERAL_LEN 108)
 (defconstant $SQL_TIMEDATE_ADD_INTERVALS 109)
-(defconstant $SQL_TIMEDATE_DIFF_INTERVALS         110)
+(defconstant $SQL_TIMEDATE_DIFF_INTERVALS          110)
 (defconstant $SQL_NEED_LONG_DATA_LEN 111)
-(defconstant $SQL_MAX_BINARY_LITERAL_LEN                  112)
-(defconstant $SQL_LIKE_ESCAPE_CLAUSE                      113)
-(defconstant $SQL_QUALIFIER_LOCATION                      114)
+(defconstant $SQL_MAX_BINARY_LITERAL_LEN                   112)
+(defconstant $SQL_LIKE_ESCAPE_CLAUSE                       113)
+(defconstant $SQL_QUALIFIER_LOCATION                       114)
 (defconstant $SQL_ACTIVE_ENVIRONMENTS 116)
 
 #|
 
 /*** ODBC SDK 2.01 Additions ***/)
-(defconstant $SQL_OJ_CAPABILITIES                       65003  ;; Temp value until ODBC 3.0
+(defconstant $SQL_OJ_CAPABILITIES                        65003  ;; Temp value until ODBC 3.0
 
-(defconstant $SQL_INFO_LAST                                            SQL_QUALIFIER_LOCATION
+(defconstant $SQL_INFO_LAST                                             SQL_QUALIFIER_LOCATION
 )
 (defconstant $SQL_INFO_DRIVER_START             1000
 
 ;; SQL_CONVERT_*  return value bitmasks
 )
-(defconstant $SQL_CVT_CHAR                             #x00000001L)
-(defconstant $SQL_CVT_NUMERIC                  #x00000002L)
-(defconstant $SQL_CVT_DECIMAL                  #x00000004L)
-(defconstant $SQL_CVT_INTEGER                  #x00000008L)
-(defconstant $SQL_CVT_SMALLINT                 #x00000010L)
-(defconstant $SQL_CVT_FLOAT                            #x00000020L)
-(defconstant $SQL_CVT_REAL                             #x00000040L)
-(defconstant $SQL_CVT_DOUBLE                           #x00000080L)
-(defconstant $SQL_CVT_VARCHAR                  #x00000100L)
-(defconstant $SQL_CVT_LONGVARCHAR              #x00000200L)
-(defconstant $SQL_CVT_BINARY                           #x00000400L)
-(defconstant $SQL_CVT_VARBINARY                        #x00000800L)
-(defconstant $SQL_CVT_BIT                              #x00001000L)
-(defconstant $SQL_CVT_TINYINT                  #x00002000L)
-(defconstant $SQL_CVT_BIGINT                           #x00004000L)
-(defconstant $SQL_CVT_DATE                             #x00008000L)
-(defconstant $SQL_CVT_TIME                             #x00010000L)
-(defconstant $SQL_CVT_TIMESTAMP                        #x00020000L)
-(defconstant $SQL_CVT_LONGVARBINARY            #x00040000L)
+(defconstant $SQL_CVT_CHAR                              #x00000001L)
+(defconstant $SQL_CVT_NUMERIC                   #x00000002L)
+(defconstant $SQL_CVT_DECIMAL                   #x00000004L)
+(defconstant $SQL_CVT_INTEGER                   #x00000008L)
+(defconstant $SQL_CVT_SMALLINT                  #x00000010L)
+(defconstant $SQL_CVT_FLOAT                             #x00000020L)
+(defconstant $SQL_CVT_REAL                              #x00000040L)
+(defconstant $SQL_CVT_DOUBLE                            #x00000080L)
+(defconstant $SQL_CVT_VARCHAR                   #x00000100L)
+(defconstant $SQL_CVT_LONGVARCHAR               #x00000200L)
+(defconstant $SQL_CVT_BINARY                            #x00000400L)
+(defconstant $SQL_CVT_VARBINARY                 #x00000800L)
+(defconstant $SQL_CVT_BIT                               #x00001000L)
+(defconstant $SQL_CVT_TINYINT                   #x00002000L)
+(defconstant $SQL_CVT_BIGINT                            #x00004000L)
+(defconstant $SQL_CVT_DATE                              #x00008000L)
+(defconstant $SQL_CVT_TIME                              #x00010000L)
+(defconstant $SQL_CVT_TIMESTAMP                 #x00020000L)
+(defconstant $SQL_CVT_LONGVARBINARY             #x00040000L)
 
 ;; SQL_CONVERT_FUNCTIONS functions)
-(defconstant $SQL_FN_CVT_CONVERT                       #x00000001L)
+(defconstant $SQL_FN_CVT_CONVERT                        #x00000001L)
 
 ;; SQL_STRING_FUNCTIONS functions
 
-(defconstant $SQL_FN_STR_CONCAT                        #x00000001L)
-(defconstant $SQL_FN_STR_INSERT                        #x00000002L)
-(defconstant $SQL_FN_STR_LEFT                  #x00000004L)
-(defconstant $SQL_FN_STR_LTRIM                 #x00000008L)
-(defconstant $SQL_FN_STR_LENGTH                        #x00000010L)
-(defconstant $SQL_FN_STR_LOCATE                        #x00000020L)
-(defconstant $SQL_FN_STR_LCASE                 #x00000040L)
-(defconstant $SQL_FN_STR_REPEAT                        #x00000080L)
-(defconstant $SQL_FN_STR_REPLACE                       #x00000100L)
-(defconstant $SQL_FN_STR_RIGHT                 #x00000200L)
-(defconstant $SQL_FN_STR_RTRIM                 #x00000400L)
-(defconstant $SQL_FN_STR_SUBSTRING             #x00000800L)
-(defconstant $SQL_FN_STR_UCASE                 #x00001000L)
-(defconstant $SQL_FN_STR_ASCII                 #x00002000L)
-(defconstant $SQL_FN_STR_CHAR                  #x00004000L
-(defconstant $SQL_FN_STR_DIFFERENCE            #x00008000L)
-(defconstant $SQL_FN_STR_LOCATE_2              #x00010000L)
-(defconstant $SQL_FN_STR_SOUNDEX                       #x00020000L)
-(defconstant $SQL_FN_STR_SPACE                 #x00040000L
+(defconstant $SQL_FN_STR_CONCAT                 #x00000001L)
+(defconstant $SQL_FN_STR_INSERT                 #x00000002L)
+(defconstant $SQL_FN_STR_LEFT                   #x00000004L)
+(defconstant $SQL_FN_STR_LTRIM                  #x00000008L)
+(defconstant $SQL_FN_STR_LENGTH                 #x00000010L)
+(defconstant $SQL_FN_STR_LOCATE                 #x00000020L)
+(defconstant $SQL_FN_STR_LCASE                  #x00000040L)
+(defconstant $SQL_FN_STR_REPEAT                 #x00000080L)
+(defconstant $SQL_FN_STR_REPLACE                        #x00000100L)
+(defconstant $SQL_FN_STR_RIGHT                  #x00000200L)
+(defconstant $SQL_FN_STR_RTRIM                  #x00000400L)
+(defconstant $SQL_FN_STR_SUBSTRING              #x00000800L)
+(defconstant $SQL_FN_STR_UCASE                  #x00001000L)
+(defconstant $SQL_FN_STR_ASCII                  #x00002000L)
+(defconstant $SQL_FN_STR_CHAR                   #x00004000L
+(defconstant $SQL_FN_STR_DIFFERENCE             #x00008000L)
+(defconstant $SQL_FN_STR_LOCATE_2               #x00010000L)
+(defconstant $SQL_FN_STR_SOUNDEX                        #x00020000L)
+(defconstant $SQL_FN_STR_SPACE                  #x00040000L
 
 ;; SQL_NUMERIC_FUNCTIONS functions
 )
-(defconstant $SQL_FN_NUM_ABS                           #x00000001L)
-(defconstant $SQL_FN_NUM_ACOS                  #x00000002L)
-(defconstant $SQL_FN_NUM_ASIN                  #x00000004L)
-(defconstant $SQL_FN_NUM_ATAN                  #x00000008L)
-(defconstant $SQL_FN_NUM_ATAN2                 #x00000010L)
-(defconstant $SQL_FN_NUM_CEILING                       #x00000020L)
-(defconstant $SQL_FN_NUM_COS                           #x00000040L)
-(defconstant $SQL_FN_NUM_COT                           #x00000080L)
-(defconstant $SQL_FN_NUM_EXP                           #x00000100L)
-(defconstant $SQL_FN_NUM_FLOOR                 #x00000200L)
-(defconstant $SQL_FN_NUM_LOG                           #x00000400L)
-(defconstant $SQL_FN_NUM_MOD                           #x00000800L)
-(defconstant $SQL_FN_NUM_SIGN                  #x00001000L)
-(defconstant $SQL_FN_NUM_SIN                           #x00002000L)
-(defconstant $SQL_FN_NUM_SQRT                  #x00004000L)
-(defconstant $SQL_FN_NUM_TAN                           #x00008000L)
-(defconstant $SQL_FN_NUM_PI                            #x00010000L)
-(defconstant $SQL_FN_NUM_RAND                  #x00020000L
-(defconstant $SQL_FN_NUM_DEGREES                       #x00040000L)
-(defconstant $SQL_FN_NUM_LOG10                 #x00080000L)
-(defconstant $SQL_FN_NUM_POWER                 #x00100000L)
-(defconstant $SQL_FN_NUM_RADIANS                       #x00200000L)
-(defconstant $SQL_FN_NUM_ROUND                 #x00400000L)
-(defconstant $SQL_FN_NUM_TRUNCATE              #x00800000L
+(defconstant $SQL_FN_NUM_ABS                            #x00000001L)
+(defconstant $SQL_FN_NUM_ACOS                   #x00000002L)
+(defconstant $SQL_FN_NUM_ASIN                   #x00000004L)
+(defconstant $SQL_FN_NUM_ATAN                   #x00000008L)
+(defconstant $SQL_FN_NUM_ATAN2                  #x00000010L)
+(defconstant $SQL_FN_NUM_CEILING                        #x00000020L)
+(defconstant $SQL_FN_NUM_COS                            #x00000040L)
+(defconstant $SQL_FN_NUM_COT                            #x00000080L)
+(defconstant $SQL_FN_NUM_EXP                            #x00000100L)
+(defconstant $SQL_FN_NUM_FLOOR                  #x00000200L)
+(defconstant $SQL_FN_NUM_LOG                            #x00000400L)
+(defconstant $SQL_FN_NUM_MOD                            #x00000800L)
+(defconstant $SQL_FN_NUM_SIGN                   #x00001000L)
+(defconstant $SQL_FN_NUM_SIN                            #x00002000L)
+(defconstant $SQL_FN_NUM_SQRT                   #x00004000L)
+(defconstant $SQL_FN_NUM_TAN                            #x00008000L)
+(defconstant $SQL_FN_NUM_PI                             #x00010000L)
+(defconstant $SQL_FN_NUM_RAND                   #x00020000L
+(defconstant $SQL_FN_NUM_DEGREES                        #x00040000L)
+(defconstant $SQL_FN_NUM_LOG10                  #x00080000L)
+(defconstant $SQL_FN_NUM_POWER                  #x00100000L)
+(defconstant $SQL_FN_NUM_RADIANS                        #x00200000L)
+(defconstant $SQL_FN_NUM_ROUND                  #x00400000L)
+(defconstant $SQL_FN_NUM_TRUNCATE               #x00800000L
 
 ;; SQL_TIMEDATE_FUNCTIONS functions
 )
-(defconstant $SQL_FN_TD_NOW                            #x00000001L)
-(defconstant $SQL_FN_TD_CURDATE                        #x00000002L)
-(defconstant $SQL_FN_TD_DAYOFMONTH             #x00000004L)
-(defconstant $SQL_FN_TD_DAYOFWEEK              #x00000008L)
-(defconstant $SQL_FN_TD_DAYOFYEAR              #x00000010L)
-(defconstant $SQL_FN_TD_MONTH                  #x00000020L)
-(defconstant $SQL_FN_TD_QUARTER                        #x00000040L)
-(defconstant $SQL_FN_TD_WEEK                           #x00000080L)
-(defconstant $SQL_FN_TD_YEAR                           #x00000100L)
-(defconstant $SQL_FN_TD_CURTIME                        #x00000200L)
-(defconstant $SQL_FN_TD_HOUR                           #x00000400L)
-(defconstant $SQL_FN_TD_MINUTE                 #x00000800L)
-(defconstant $SQL_FN_TD_SECOND                 #x00001000L
-(defconstant $SQL_FN_TD_TIMESTAMPADD           #x00002000L)
-(defconstant $SQL_FN_TD_TIMESTAMPDIFF  #x00004000L)
-(defconstant $SQL_FN_TD_DAYNAME                        #x00008000L)
-(defconstant $SQL_FN_TD_MONTHNAME              #x00010000L
+(defconstant $SQL_FN_TD_NOW                             #x00000001L)
+(defconstant $SQL_FN_TD_CURDATE                 #x00000002L)
+(defconstant $SQL_FN_TD_DAYOFMONTH              #x00000004L)
+(defconstant $SQL_FN_TD_DAYOFWEEK               #x00000008L)
+(defconstant $SQL_FN_TD_DAYOFYEAR               #x00000010L)
+(defconstant $SQL_FN_TD_MONTH                   #x00000020L)
+(defconstant $SQL_FN_TD_QUARTER                 #x00000040L)
+(defconstant $SQL_FN_TD_WEEK                            #x00000080L)
+(defconstant $SQL_FN_TD_YEAR                            #x00000100L)
+(defconstant $SQL_FN_TD_CURTIME                 #x00000200L)
+(defconstant $SQL_FN_TD_HOUR                            #x00000400L)
+(defconstant $SQL_FN_TD_MINUTE                  #x00000800L)
+(defconstant $SQL_FN_TD_SECOND                  #x00001000L
+(defconstant $SQL_FN_TD_TIMESTAMPADD            #x00002000L)
+(defconstant $SQL_FN_TD_TIMESTAMPDIFF   #x00004000L)
+(defconstant $SQL_FN_TD_DAYNAME                 #x00008000L)
+(defconstant $SQL_FN_TD_MONTHNAME               #x00010000L
 
 ;; SQL_SYSTEM_FUNCTIONS functions
 )
-(defconstant $SQL_FN_SYS_USERNAME              #x00000001L)
-(defconstant $SQL_FN_SYS_DBNAME                        #x00000002L)
-(defconstant $SQL_FN_SYS_IFNULL                        #x00000004L
+(defconstant $SQL_FN_SYS_USERNAME               #x00000001L)
+(defconstant $SQL_FN_SYS_DBNAME                 #x00000002L)
+(defconstant $SQL_FN_SYS_IFNULL                 #x00000004L
 
 ;; SQL_TIMEDATE_ADD_INTERVALS and SQL_TIMEDATE_DIFF_INTERVALS functions
 
-(defconstant $SQL_FN_TSI_FRAC_SECOND           #x00000001L)
-(defconstant $SQL_FN_TSI_SECOND                        #x00000002L)
-(defconstant $SQL_FN_TSI_MINUTE                        #x00000004L)
-(defconstant $SQL_FN_TSI_HOUR                  #x00000008L)
-(defconstant $SQL_FN_TSI_DAY                           #x00000010L)
-(defconstant $SQL_FN_TSI_WEEK                  #x00000020L)
-(defconstant $SQL_FN_TSI_MONTH                 #x00000040L)
-(defconstant $SQL_FN_TSI_QUARTER                       #x00000080L)
-(defconstant $SQL_FN_TSI_YEAR                  #x00000100L
+(defconstant $SQL_FN_TSI_FRAC_SECOND            #x00000001L)
+(defconstant $SQL_FN_TSI_SECOND                 #x00000002L)
+(defconstant $SQL_FN_TSI_MINUTE                 #x00000004L)
+(defconstant $SQL_FN_TSI_HOUR                   #x00000008L)
+(defconstant $SQL_FN_TSI_DAY                            #x00000010L)
+(defconstant $SQL_FN_TSI_WEEK                   #x00000020L)
+(defconstant $SQL_FN_TSI_MONTH                  #x00000040L)
+(defconstant $SQL_FN_TSI_QUARTER                        #x00000080L)
+(defconstant $SQL_FN_TSI_YEAR                   #x00000100L
 
 ;; SQL_ODBC_API_CONFORMANCE values
 )
-(defconstant $SQL_OAC_NONE                             #x0000)
-(defconstant $SQL_OAC_LEVEL1                           #x0001)
-(defconstant $SQL_OAC_LEVEL2                           #x0002
+(defconstant $SQL_OAC_NONE                              #x0000)
+(defconstant $SQL_OAC_LEVEL1                            #x0001)
+(defconstant $SQL_OAC_LEVEL2                            #x0002
 
 ;; SQL_ODBC_SAG_CLI_CONFORMANCE values
 )
-(defconstant $SQL_OSCC_NOT_COMPLIANT           #x0000)
-(defconstant $SQL_OSCC_COMPLIANT                       #x0001
+(defconstant $SQL_OSCC_NOT_COMPLIANT            #x0000)
+(defconstant $SQL_OSCC_COMPLIANT                        #x0001
 
 ;; SQL_ODBC_SQL_CONFORMANCE values
 )
-(defconstant $SQL_OSC_MINIMUM                  #x0000)
-(defconstant $SQL_OSC_CORE                             #x0001)
-(defconstant $SQL_OSC_EXTENDED                 #x0002
+(defconstant $SQL_OSC_MINIMUM                   #x0000)
+(defconstant $SQL_OSC_CORE                              #x0001)
+(defconstant $SQL_OSC_EXTENDED                  #x0002
 
 ;; SQL_CONCAT_NULL_BEHAVIOR values
 )
-(defconstant $SQL_CB_NULL                              #x0000)
-(defconstant $SQL_CB_NON_NULL                  #x0001
+(defconstant $SQL_CB_NULL                               #x0000)
+(defconstant $SQL_CB_NON_NULL                   #x0001
 
 ;; SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values
 )
-(defconstant $SQL_CB_DELETE                            #x0000)
-(defconstant $SQL_CB_CLOSE                             #x0001)
-(defconstant $SQL_CB_PRESERVE                          #x0002
+(defconstant $SQL_CB_DELETE                             #x0000)
+(defconstant $SQL_CB_CLOSE                              #x0001)
+(defconstant $SQL_CB_PRESERVE                           #x0002
 
 ;; SQL_IDENTIFIER_CASE values
 )
-(defconstant $SQL_IC_UPPER                             #x0001)
-(defconstant $SQL_IC_LOWER                             #x0002)
-(defconstant $SQL_IC_SENSITIVE                 #x0003)
-(defconstant $SQL_IC_MIXED                             #x0004
+(defconstant $SQL_IC_UPPER                              #x0001)
+(defconstant $SQL_IC_LOWER                              #x0002)
+(defconstant $SQL_IC_SENSITIVE                  #x0003)
+(defconstant $SQL_IC_MIXED                              #x0004
 
 ;; SQL_TXN_CAPABLE values
 |#
 #|
 ;; SQL_TXN_ISOLATION_OPTION masks
 )
-(defconstant $SQL_TXN_READ_UNCOMMITTED #x00000001L)
-(defconstant $SQL_TXN_READ_COMMITTED           #x00000002L)
-(defconstant $SQL_TXN_REPEATABLE_READ  #x00000004L)
-(defconstant $SQL_TXN_SERIALIZABLE             #x00000008L)
-(defconstant $SQL_TXN_VERSIONING                       #x00000010L
+(defconstant $SQL_TXN_READ_UNCOMMITTED  #x00000001L)
+(defconstant $SQL_TXN_READ_COMMITTED            #x00000002L)
+(defconstant $SQL_TXN_REPEATABLE_READ   #x00000004L)
+(defconstant $SQL_TXN_SERIALIZABLE              #x00000008L)
+(defconstant $SQL_TXN_VERSIONING                        #x00000010L
 
 ;; SQL_CORRELATION_NAME values
 )
-(defconstant $SQL_CN_NONE                              #x0000)
-(defconstant $SQL_CN_DIFFERENT                 #x0001)
-(defconstant $SQL_CN_ANY                                       #x0002
+(defconstant $SQL_CN_NONE                               #x0000)
+(defconstant $SQL_CN_DIFFERENT                  #x0001)
+(defconstant $SQL_CN_ANY                                        #x0002
 
 ;; SQL_NON_NULLABLE_COLUMNS values
 )
-(defconstant $SQL_NNC_NULL                             #x0000)
-(defconstant $SQL_NNC_NON_NULL                 #x0001
+(defconstant $SQL_NNC_NULL                              #x0000)
+(defconstant $SQL_NNC_NON_NULL                  #x0001
 
 ;; SQL_NULL_COLLATION values
-                                                                         )
-(defconstant $SQL_NC_HIGH                              #x0000)
-(defconstant $SQL_NC_LOW                                       #x0001)
-(defconstant $SQL_NC_START                             #x0002)
-(defconstant $SQL_NC_END                                       #x0004
+                                                                          )
+(defconstant $SQL_NC_HIGH                               #x0000)
+(defconstant $SQL_NC_LOW                                        #x0001)
+(defconstant $SQL_NC_START                              #x0002)
+(defconstant $SQL_NC_END                                        #x0004
 
 ;; SQL_FILE_USAGE values
 )
-(defconstant $SQL_FILE_NOT_SUPPORTED           #x0000)
-(defconstant $SQL_FILE_TABLE                           #x0001)
-(defconstant $SQL_FILE_QUALIFIER                       #x0002
+(defconstant $SQL_FILE_NOT_SUPPORTED            #x0000)
+(defconstant $SQL_FILE_TABLE                            #x0001)
+(defconstant $SQL_FILE_QUALIFIER                        #x0002
 
 ;; SQL_GETDATA_EXTENSIONS values
 )
-(defconstant $SQL_GD_ANY_COLUMN                        #x00000001L)
-(defconstant $SQL_GD_ANY_ORDER                 #x00000002L)
-(defconstant $SQL_GD_BLOCK                             #x00000004L)
-(defconstant $SQL_GD_BOUND                             #x00000008L
+(defconstant $SQL_GD_ANY_COLUMN                 #x00000001L)
+(defconstant $SQL_GD_ANY_ORDER                  #x00000002L)
+(defconstant $SQL_GD_BLOCK                              #x00000004L)
+(defconstant $SQL_GD_BOUND                              #x00000008L
 
 ;; SQL_ALTER_TABLE values
 )
-(defconstant $SQL_AT_ADD_COLUMN                        #x00000001L)
-(defconstant $SQL_AT_DROP_COLUMN                       #x00000002L
+(defconstant $SQL_AT_ADD_COLUMN                 #x00000001L)
+(defconstant $SQL_AT_DROP_COLUMN                        #x00000002L
 
 ;; SQL_POSITIONED_STATEMENTS masks
 )
-(defconstant $SQL_PS_POSITIONED_DELETE #x00000001L)
-(defconstant $SQL_PS_POSITIONED_UPDATE #x00000002L)
-(defconstant $SQL_PS_SELECT_FOR_UPDATE #x00000004L
+(defconstant $SQL_PS_POSITIONED_DELETE  #x00000001L)
+(defconstant $SQL_PS_POSITIONED_UPDATE  #x00000002L)
+(defconstant $SQL_PS_SELECT_FOR_UPDATE  #x00000004L
 
 ;; SQL_GROUP_BY values
 )
-(defconstant $SQL_GB_NOT_SUPPORTED                     #x0000)
-(defconstant $SQL_GB_GROUP_BY_EQUALS_SELECT    #x0001)
-(defconstant $SQL_GB_GROUP_BY_CONTAINS_SELECT  #x0002)
-(defconstant $SQL_GB_NO_RELATION                               #x0003
-                                                                                                       
+(defconstant $SQL_GB_NOT_SUPPORTED                      #x0000)
+(defconstant $SQL_GB_GROUP_BY_EQUALS_SELECT     #x0001)
+(defconstant $SQL_GB_GROUP_BY_CONTAINS_SELECT   #x0002)
+(defconstant $SQL_GB_NO_RELATION                                #x0003
+
 ;; SQL_OWNER_USAGE masks
 )
-(defconstant $SQL_OU_DML_STATEMENTS            #x00000001L)
+(defconstant $SQL_OU_DML_STATEMENTS             #x00000001L)
 (defconstant $SQL_OU_PROCEDURE_INVOCATION #x00000002L)
-(defconstant $SQL_OU_TABLE_DEFINITION  #x00000004L)
-(defconstant $SQL_OU_INDEX_DEFINITION  #x00000008L)
+(defconstant $SQL_OU_TABLE_DEFINITION   #x00000004L)
+(defconstant $SQL_OU_INDEX_DEFINITION   #x00000008L)
 (defconstant $SQL_OU_PRIVILEGE_DEFINITION #x00000010L
 
 ;; SQL_QUALIFIER_USAGE masks
 )
-(defconstant $SQL_QU_DML_STATEMENTS            #x00000001L)
+(defconstant $SQL_QU_DML_STATEMENTS             #x00000001L)
 (defconstant $SQL_QU_PROCEDURE_INVOCATION #x00000002L)
-(defconstant $SQL_QU_TABLE_DEFINITION  #x00000004L)
-(defconstant $SQL_QU_INDEX_DEFINITION  #x00000008L)
+(defconstant $SQL_QU_TABLE_DEFINITION   #x00000004L)
+(defconstant $SQL_QU_INDEX_DEFINITION   #x00000008L)
 (defconstant $SQL_QU_PRIVILEGE_DEFINITION #x00000010L
 
 ;; SQL_SUBQUERIES masks
 )
-(defconstant $SQL_SQ_COMPARISON                                #x00000001L)
-(defconstant $SQL_SQ_EXISTS                                    #x00000002L)
-(defconstant $SQL_SQ_IN                                                #x00000004L)
-(defconstant $SQL_SQ_QUANTIFIED                                #x00000008L)
-(defconstant $SQL_SQ_CORRELATED_SUBQUERIES     #x00000010L
+(defconstant $SQL_SQ_COMPARISON                         #x00000001L)
+(defconstant $SQL_SQ_EXISTS                                     #x00000002L)
+(defconstant $SQL_SQ_IN                                         #x00000004L)
+(defconstant $SQL_SQ_QUANTIFIED                         #x00000008L)
+(defconstant $SQL_SQ_CORRELATED_SUBQUERIES      #x00000010L
 
 ;; SQL_UNION masks
 )
-(defconstant $SQL_U_UNION                                              #x00000001L)
-(defconstant $SQL_U_UNION_ALL                                  #x00000002L
+(defconstant $SQL_U_UNION                                               #x00000001L)
+(defconstant $SQL_U_UNION_ALL                                   #x00000002L
 
 ;; SQL_BOOKMARK_PERSISTENCE values
 )
-(defconstant $SQL_BP_CLOSE                             #x00000001L)
-(defconstant $SQL_BP_DELETE                            #x00000002L)
-(defconstant $SQL_BP_DROP                              #x00000004L)
-(defconstant $SQL_BP_TRANSACTION                       #x00000008L)
-(defconstant $SQL_BP_UPDATE                            #x00000010L)
-(defconstant $SQL_BP_OTHER_HSTMT                       #x00000020L)
-(defconstant $SQL_BP_SCROLL                            #x00000040L
+(defconstant $SQL_BP_CLOSE                              #x00000001L)
+(defconstant $SQL_BP_DELETE                             #x00000002L)
+(defconstant $SQL_BP_DROP                               #x00000004L)
+(defconstant $SQL_BP_TRANSACTION                        #x00000008L)
+(defconstant $SQL_BP_UPDATE                             #x00000010L)
+(defconstant $SQL_BP_OTHER_HSTMT                        #x00000020L)
+(defconstant $SQL_BP_SCROLL                             #x00000040L
 
 ;; SQL_STATIC_SENSITIVITY values
 )
-(defconstant $SQL_SS_ADDITIONS                 #x00000001L)
-(defconstant $SQL_SS_DELETIONS                 #x00000002L)
-(defconstant $SQL_SS_UPDATES                           #x00000004L
+(defconstant $SQL_SS_ADDITIONS                  #x00000001L)
+(defconstant $SQL_SS_DELETIONS                  #x00000002L)
+(defconstant $SQL_SS_UPDATES                            #x00000004L
 
 ;; SQL_LOCK_TYPESL masks
 )
-(defconstant $SQL_LCK_NO_CHANGE                        #x00000001L)
-(defconstant $SQL_LCK_EXCLUSIVE                        #x00000002L)
-(defconstant $SQL_LCK_UNLOCK                           #x00000004L
+(defconstant $SQL_LCK_NO_CHANGE                 #x00000001L)
+(defconstant $SQL_LCK_EXCLUSIVE                 #x00000002L)
+(defconstant $SQL_LCK_UNLOCK                            #x00000004L
 
 ;; SQL_POS_OPERATIONS masks
 |#
 #|
 ;; SQL_QUALIFIER_LOCATION values
 )
-(defconstant $SQL_QL_START                             #x0001L)
-(defconstant $SQL_QL_END                                       #x0002L
+(defconstant $SQL_QL_START                              #x0001L)
+(defconstant $SQL_QL_END                                        #x0002L
 
 ;; SQL_OJ_CAPABILITIES values
 
-(defconstant $SQL_OJ_LEFT                                      #x00000001L)
-(defconstant $SQL_OJ_RIGHT                             #x00000002L)
-(defconstant $SQL_OJ_FULL                                      #x00000004L)
-(defconstant $SQL_OJ_NESTED                            #x00000008L)
-(defconstant $SQL_OJ_NOT_ORDERED                       #x00000010L)
-(defconstant $SQL_OJ_INNER                             #x00000020L)
-(defconstant $SQL_OJ_ALL_COMPARISON_OPS        #x00000040L
+(defconstant $SQL_OJ_LEFT                                       #x00000001L)
+(defconstant $SQL_OJ_RIGHT                              #x00000002L)
+(defconstant $SQL_OJ_FULL                                       #x00000004L)
+(defconstant $SQL_OJ_NESTED                             #x00000008L)
+(defconstant $SQL_OJ_NOT_ORDERED                        #x00000010L)
+(defconstant $SQL_OJ_INNER                              #x00000020L)
+(defconstant $SQL_OJ_ALL_COMPARISON_OPS #x00000040L
 
 ;; options for SQLGetStmtOption/SQLSetStmtOption)
-(defconstant $SQL_QUERY_TIMEOUT                        0)
-(defconstant $SQL_MAX_ROWS                             1)
-(defconstant $SQL_NOSCAN                                       2)
-(defconstant $SQL_MAX_LENGTH                           3)
-(defconstant $SQL_ASYNC_ENABLE                 4)
-(defconstant $SQL_BIND_TYPE                            5
-(defconstant $SQL_CURSOR_TYPE                  6)
-(defconstant $SQL_CONCURRENCY                  7)
-(defconstant $SQL_KEYSET_SIZE                  8)
-(defconstant $SQL_ROWSET_SIZE                  9)
-(defconstant $SQL_SIMULATE_CURSOR              10)
-(defconstant $SQL_RETRIEVE_DATA                        11)
-(defconstant $SQL_USE_BOOKMARKS                        12)
-(defconstant $SQL_GET_BOOKMARK                 13      /*      GetStmtOption Only)
-(defconstant $SQL_ROW_NUMBER                           14      /*      GetStmtOption Only)
-(defconstant $SQL_STMT_OPT_MAX                 SQL_ROW_NUMBER
+(defconstant $SQL_QUERY_TIMEOUT                 0)
+(defconstant $SQL_MAX_ROWS                              1)
+(defconstant $SQL_NOSCAN                                        2)
+(defconstant $SQL_MAX_LENGTH                            3)
+(defconstant $SQL_ASYNC_ENABLE                  4)
+(defconstant $SQL_BIND_TYPE                             5
+(defconstant $SQL_CURSOR_TYPE                   6)
+(defconstant $SQL_CONCURRENCY                   7)
+(defconstant $SQL_KEYSET_SIZE                   8)
+(defconstant $SQL_ROWSET_SIZE                   9)
+(defconstant $SQL_SIMULATE_CURSOR               10)
+(defconstant $SQL_RETRIEVE_DATA                 11)
+(defconstant $SQL_USE_BOOKMARKS                 12)
+(defconstant $SQL_GET_BOOKMARK                  13      /*      GetStmtOption Only)
+(defconstant $SQL_ROW_NUMBER                            14      /*      GetStmtOption Only)
+(defconstant $SQL_STMT_OPT_MAX                  SQL_ROW_NUMBER
 )
-(defconstant $SQL_STMT_OPT_MIN                 SQL_QUERY_TIMEOUT
+(defconstant $SQL_STMT_OPT_MIN                  SQL_QUERY_TIMEOUT
 
 
 ;; SQL_QUERY_TIMEOUT options)
-(defconstant $SQL_QUERY_TIMEOUT_DEFAULT        0UL
+(defconstant $SQL_QUERY_TIMEOUT_DEFAULT 0UL
 
 ;; SQL_MAX_ROWS options)
-(defconstant $SQL_MAX_ROWS_DEFAULT             0UL
+(defconstant $SQL_MAX_ROWS_DEFAULT              0UL
 
 ;; SQL_NOSCAN options)
-(defconstant $SQL_NOSCAN_OFF                           0UL     /*      1.0 FALSE)
-(defconstant $SQL_NOSCAN_ON                            1UL     /*      1.0 TRUE)
-(defconstant $SQL_NOSCAN_DEFAULT                       SQL_NOSCAN_OFF
+(defconstant $SQL_NOSCAN_OFF                            0UL     /*      1.0 FALSE)
+(defconstant $SQL_NOSCAN_ON                             1UL     /*      1.0 TRUE)
+(defconstant $SQL_NOSCAN_DEFAULT                        SQL_NOSCAN_OFF
 
 ;; SQL_MAX_LENGTH options)
-(defconstant $SQL_MAX_LENGTH_DEFAULT           0UL
+(defconstant $SQL_MAX_LENGTH_DEFAULT            0UL
 
 ;; SQL_ASYNC_ENABLE options)
-(defconstant $SQL_ASYNC_ENABLE_OFF             0UL)
-(defconstant $SQL_ASYNC_ENABLE_ON                      1UL)
-(defconstant $SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF
+(defconstant $SQL_ASYNC_ENABLE_OFF              0UL)
+(defconstant $SQL_ASYNC_ENABLE_ON                       1UL)
+(defconstant $SQL_ASYNC_ENABLE_DEFAULT  SQL_ASYNC_ENABLE_OFF
 
 ;; SQL_BIND_TYPE options)
-(defconstant $SQL_BIND_BY_COLUMN                       0UL)
-(defconstant $SQL_BIND_TYPE_DEFAULT            SQL_BIND_BY_COLUMN              ;; Default value
+(defconstant $SQL_BIND_BY_COLUMN                        0UL)
+(defconstant $SQL_BIND_TYPE_DEFAULT             SQL_BIND_BY_COLUMN              ;; Default value
 
 ;; SQL_CONCURRENCY options)
-(defconstant $SQL_CONCUR_READ_ONLY             1)
-(defconstant $SQL_CONCUR_LOCK                  2)
-(defconstant $SQL_CONCUR_ROWVER                        3)
-(defconstant $SQL_CONCUR_VALUES                        4)
-(defconstant $SQL_CONCUR_DEFAULT                       SQL_CONCUR_READ_ONLY    ;; Default value
+(defconstant $SQL_CONCUR_READ_ONLY              1)
+(defconstant $SQL_CONCUR_LOCK                   2)
+(defconstant $SQL_CONCUR_ROWVER                 3)
+(defconstant $SQL_CONCUR_VALUES                 4)
+(defconstant $SQL_CONCUR_DEFAULT                        SQL_CONCUR_READ_ONLY    ;; Default value
 
 ;; SQL_CURSOR_TYPE options)
-(defconstant $SQL_CURSOR_FORWARD_ONLY  0UL)
-(defconstant $SQL_CURSOR_KEYSET_DRIVEN 1UL)
-(defconstant $SQL_CURSOR_DYNAMIC                       2UL)
-(defconstant $SQL_CURSOR_STATIC                        3UL)
-(defconstant $SQL_CURSOR_TYPE_DEFAULT          SQL_CURSOR_FORWARD_ONLY ;; Default value
+(defconstant $SQL_CURSOR_FORWARD_ONLY   0UL)
+(defconstant $SQL_CURSOR_KEYSET_DRIVEN  1UL)
+(defconstant $SQL_CURSOR_DYNAMIC                        2UL)
+(defconstant $SQL_CURSOR_STATIC                 3UL)
+(defconstant $SQL_CURSOR_TYPE_DEFAULT           SQL_CURSOR_FORWARD_ONLY ;; Default value
 
 ;; SQL_ROWSET_SIZE options)
-(defconstant $SQL_ROWSET_SIZE_DEFAULT  1UL
+(defconstant $SQL_ROWSET_SIZE_DEFAULT   1UL
 
 ;; SQL_KEYSET_SIZE options)
-(defconstant $SQL_KEYSET_SIZE_DEFAULT          0UL
+(defconstant $SQL_KEYSET_SIZE_DEFAULT           0UL
 
 ;; SQL_SIMULATE_CURSOR options)
-(defconstant $SQL_SC_NON_UNIQUE                        0UL)
-(defconstant $SQL_SC_TRY_UNIQUE                        1UL)
-(defconstant $SQL_SC_UNIQUE                            2UL
+(defconstant $SQL_SC_NON_UNIQUE                 0UL)
+(defconstant $SQL_SC_TRY_UNIQUE                 1UL)
+(defconstant $SQL_SC_UNIQUE                             2UL
 
 ;; SQL_RETRIEVE_DATA options)
-(defconstant $SQL_RD_OFF                                       0UL)
-(defconstant $SQL_RD_ON                                        1UL)
-(defconstant $SQL_RD_DEFAULT                           SQL_RD_ON
+(defconstant $SQL_RD_OFF                                        0UL)
+(defconstant $SQL_RD_ON                                 1UL)
+(defconstant $SQL_RD_DEFAULT                            SQL_RD_ON
 
 ;; SQL_USE_BOOKMARKS options)
-(defconstant $SQL_UB_OFF                                       0UL)
-(defconstant $SQL_UB_ON                                        1UL)
-(defconstant $SQL_UB_DEFAULT                           SQL_UB_OFF
+(defconstant $SQL_UB_OFF                                        0UL)
+(defconstant $SQL_UB_ON                                 1UL)
+(defconstant $SQL_UB_DEFAULT                            SQL_UB_OFF
 
 
 |#
 (defconstant $SQL_OPT_TRACEFILE 105)
 (defconstant $SQL_TRANSLATE_DLL 106)
 (defconstant $SQL_TRANSLATE_OPTION 107)
-(defconstant $SQL_TXN_ISOLATION 108) 
+(defconstant $SQL_TXN_ISOLATION 108)
 (defconstant $SQL_CURRENT_QUALIFIER 109)
 (defconstant $SQL_ODBC_CURSORS 110)
 (defconstant $SQL_QUIET_MODE 111)
 (defconstant $SQL_CONN_OPT_MAX $SQL_PACKET_SIZE)
 (defconstant $SQL_CONNECT_OPT_DRVR_START 1000)
 
-;;#define      SQL_CONN_OPT_MIN                        SQL_ACCESS_MODE
+;;#define       SQL_CONN_OPT_MIN                        SQL_ACCESS_MODE
 
 ;; SQL_ACCESS_MODE options
 (defconstant $SQL_MODE_READ_WRITE 0) ; 0UL
 (defconstant $SQL_AUTOCOMMIT_DEFAULT $SQL_AUTOCOMMIT_ON)
 
 ;; SQL_LOGIN_TIMEOUT options)
-(defconstant $SQL_LOGIN_TIMEOUT_DEFAULT        15) ; 15UL
+(defconstant $SQL_LOGIN_TIMEOUT_DEFAULT 15) ; 15UL
 
 ;; SQL_OPT_TRACE options)
 (defconstant $SQL_OPT_TRACE_OFF 0) ; 0UL
 (defconstant $SQL_OPT_TRACE_ON 1) ; 1UL
 (defconstant $SQL_OPT_TRACE_DEFAULT $SQL_OPT_TRACE_OFF)
 ; #ifndef SQL_OPT_TRACE_FILE_DEFAULT
-; (defconstant $SQL_OPT_TRACE_FILE_DEFAULT     "\\SQL.LOG"
+; (defconstant $SQL_OPT_TRACE_FILE_DEFAULT      "\\SQL.LOG"
 ;; #endif
 
 (defconstant $SQL_CUR_USE_IF_NEEDED 0) ; 0UL
 (defconstant $SQL_BEST_ROWID 1)
 (defconstant $SQL_ROWVER 2)
 )
-(defconstant $SQL_SCOPE_CURROW                 0)
-(defconstant $SQL_SCOPE_TRANSACTION            1)
-(defconstant $SQL_SCOPE_SESSION                        2
+(defconstant $SQL_SCOPE_CURROW                  0)
+(defconstant $SQL_SCOPE_TRANSACTION             1)
+(defconstant $SQL_SCOPE_SESSION                 2
 
 ;; Defines for SQLSetPos)
-(defconstant $SQL_ENTIRE_ROWSET                        0
+(defconstant $SQL_ENTIRE_ROWSET                 0
 |#
 
 ;; Operations in SQLSetPos
 (defconstant $SQL_LOCK_UNLOCK 2)
 
 ;; SQLBindParameter extensions
-(defconstant $SQL_DEFAULT_PARAM        -5)
+(defconstant $SQL_DEFAULT_PARAM -5)
 (defconstant $SQL_IGNORE -6)
 (defconstant $SQL_LEN_DATA_AT_EXEC_OFFSET -100)
 ;(defconstant $SQL_LEN_DATA_AT_EXEC(length) (-length+SQL_LEN_DATA_AT_EXEC_OFFSET)
 
 ; #ifndef RC_INVOKED
 
-/*     This define is too large for RC)
+/*      This define is too large for RC)
 (defconstant $SQL_ODBC_KEYWORDS \
 "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
 "ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\
 (defconstant $SQL_TYPE_DRIVER_END $SQL_UNICODE)
 
 
-(defconstant $SQL_SIGNED_OFFSET        -20)
+(defconstant $SQL_SIGNED_OFFSET -20)
 (defconstant $SQL_UNSIGNED_OFFSET -22)
 
 ;; C datatype to SQL datatype mapping
index 2a60462..6723a1a 100644 (file)
@@ -40,7 +40,7 @@
    #:run-prepared-sql
    #:set-autocommit
    #:sql
-   
+
    #:*auto-trim-strings*
    #:*default-database*
    #:*default-odbc-external-format*
 
 (defgeneric terminate (src))
 (defgeneric db-open-query (src query-expression
-                              &key arglen col-positions result-types width
-                              &allow-other-keys))
+                               &key arglen col-positions result-types width
+                               &allow-other-keys))
 (defgeneric db-fetch-query-results (src &optional count))
 (defgeneric %db-execute (src sql-expression &key &allow-other-keys))
 (defgeneric db-execute-command (src sql-string))
 
 (defgeneric %initialize-query (src arglen col-positions
-                                  &key result-types width))
+                                   &key result-types width))
 
 (defgeneric %read-query-data (src ignore-columns))
 (defgeneric db-map-query (src type function query-exp &key result-types))
 (defgeneric db-prepare-statement (src sql &key parameter-table
-                                     parameter-columns))
+                                      parameter-columns))
 (defgeneric get-odbc-info (src info-type))
 
 
    (computed-result-types :initform nil :initarg :computed-result-types :accessor computed-result-types)
    (column-count :initform nil :accessor column-count)
    (column-names :initform (make-array 0 :element-type 'string :adjustable t :fill-pointer t)
-                :accessor column-names)
+                 :accessor column-names)
    (column-c-types :initform (make-array 0 :element-type 'fixnum :adjustable t :fill-pointer t)
-                  :accessor column-c-types)
+                   :accessor column-c-types)
    (column-sql-types :initform (make-array 0 :element-type 'fixnum :adjustable t :fill-pointer t)
-                    :accessor column-sql-types)
+                     :accessor column-sql-types)
    (column-data-ptrs :initform (make-array 0 :adjustable t :fill-pointer t)
-                    :accessor data-ptrs)
+                     :accessor data-ptrs)
    (column-out-len-ptrs :initform (make-array 0 :adjustable t :fill-pointer t)
-                       :accessor column-out-len-ptrs)
+                        :accessor column-out-len-ptrs)
    (column-precisions :initform (make-array 0 :element-type 'fixnum :adjustable t :fill-pointer t)
-                     :accessor column-precisions)
+                      :accessor column-precisions)
    (column-scales :initform (make-array 0 :element-type 'fixnum :adjustable t :fill-pointer t)
-                 :accessor column-scales)
+                  :accessor column-scales)
    (column-nullables-p :initform (make-array 0 :element-type 'fixnum :adjustable t :fill-pointer t)
-                      :accessor column-nullables-p)
+                       :accessor column-nullables-p)
       ;;(parameter-count :initform 0 :accessor parameter-count)
    (parameter-data-ptrs :initform (make-array 0 :adjustable t :fill-pointer t)
-                       :accessor parameter-ptrs)
+                        :accessor parameter-ptrs)
    ;; a query string or a query expression object
    (sql-expression :initform nil :initarg :sql-expression :accessor sql-expression)
    ;; database object the query is to be run against
@@ -130,8 +130,8 @@ the query against." ))
       (setf (henv db) (%new-environment-handle)))
     (setf (hdbc db) (%new-db-connection-handle (henv db)))
     (if connection-string
-        (%sql-driver-connect (hdbc db) 
-                             connection-string 
+        (%sql-driver-connect (hdbc db)
+                             connection-string
                              (ecase completion
                                (:no-prompt odbc::$SQL_DRIVER_NOPROMPT)
                                (:complete odbc::$SQL_DRIVER_COMPLETE)
@@ -142,42 +142,42 @@ the query against." ))
     #+ignore (setf (db-hstmt db) (%new-statement-handle (hdbc db)))
     (when (/= (get-odbc-info db odbc::$SQL_TXN_CAPABLE) odbc::$SQL_TC_NONE)
       (if autocommit
-         (enable-autocommit (hdbc db))
-         (disable-autocommit (hdbc db))))
+          (enable-autocommit (hdbc db))
+          (disable-autocommit (hdbc db))))
     db))
 
 (defun disconnect (database)
   (with-slots (hdbc queries) database
     (dolist (query queries)
       (if (query-active-p query)
-         (with-slots (hstmt) query
-           (when hstmt 
-             (%free-statement hstmt :drop)
-             (setf hstmt nil)))))
+          (with-slots (hstmt) query
+            (when hstmt
+              (%free-statement hstmt :drop)
+              (setf hstmt nil)))))
     (when (db-hstmt database)
       (%free-statement (db-hstmt database) :drop))
     (%disconnect hdbc)))
 
 
-(defun sql (expr &key db result-types row-count (column-names t) query 
-                     hstmt width)
+(defun sql (expr &key db result-types row-count (column-names t) query
+                      hstmt width)
   (declare (ignore hstmt))
   (cond
    (query
     (let ((q (db-open-query db expr :result-types result-types :width width)))
       (if column-names
-         (values q (column-names q))
-       q)))
+          (values q (column-names q))
+        q)))
    (t
     (multiple-value-bind (data col-names)
-       (db-query db expr :result-types result-types :width width)
+        (db-query db expr :result-types result-types :width width)
       (cond
-       (row-count
-        (if (consp data) (length data) data))
-       (column-names
-        (values data col-names))
-       (t
-        data))))))
+        (row-count
+         (if (consp data) (length data) data))
+        (column-names
+         (values data col-names))
+        (t
+         data))))))
 
 (defun fetch-row (query &optional (eof-errorp t) eof-value)
   (multiple-value-bind (row query count) (db-fetch-query-results query 1)
@@ -185,12 +185,12 @@ the query against." ))
      ((zerop count)
       (close-query query)
       (when eof-errorp
-       (error 'clsql:sql-database-data-error
-              :message "ODBC: Ran out of data in fetch-row"))
+        (error 'clsql:sql-database-data-error
+               :message "ODBC: Ran out of data in fetch-row"))
       eof-value)
      (t
       (car row)))))
-      
+
 
 (defun close-query (query)
   (db-close-query query))
@@ -199,29 +199,29 @@ the query against." ))
   (declare (ignore hstmt))
   (let ((query (get-free-query db)))
     (unwind-protect
-       (progn
-         (with-slots (hstmt) query
-           (unless hstmt (setf hstmt (%new-statement-handle (hdbc db))))
-           (%list-tables hstmt)
-           (%initialize-query query nil nil)
-           (values
-            (db-fetch-query-results query)
-            (coerce (column-names query) 'list))))
+        (progn
+          (with-slots (hstmt) query
+            (unless hstmt (setf hstmt (%new-statement-handle (hdbc db))))
+            (%list-tables hstmt)
+            (%initialize-query query nil nil)
+            (values
+             (db-fetch-query-results query)
+             (coerce (column-names query) 'list))))
       (db-close-query query))))
 
 (defun list-table-indexes (table &key db unique hstmt)
   (declare (ignore hstmt))
   (let ((query (get-free-query db)))
     (unwind-protect
-       (progn
-         (with-slots (hstmt) query
-           (unless hstmt
-             (setf hstmt (%new-statement-handle (hdbc db))))
-           (%table-statistics table hstmt :unique unique)
-           (%initialize-query query nil nil)
-           (values
-            (db-fetch-query-results query)
-            (coerce (column-names query) 'list))))
+        (progn
+          (with-slots (hstmt) query
+            (unless hstmt
+              (setf hstmt (%new-statement-handle (hdbc db))))
+            (%table-statistics table hstmt :unique unique)
+            (%initialize-query query nil nil)
+            (values
+             (db-fetch-query-results query)
+             (coerce (column-names query) 'list))))
       (db-close-query query))))
 
 (defun list-all-table-columns (table &key db hstmt)
@@ -257,13 +257,13 @@ the query against." ))
      (:henv (henv ,*default-database*) :hdbc (hdbc ,*default-database*))
      ,@body))
 
-(defmethod initialize-instance :after ((query odbc-query) 
+(defmethod initialize-instance :after ((query odbc-query)
                                        &key sql henv hdbc &allow-other-keys)
   (when sql
     (let ((hstmt (%new-statement-handle hdbc)))
       (%sql-exec-direct sql hstmt henv hdbc)
-      (with-slots (column-count 
-                   column-names column-c-types column-sql-types column-data-ptrs 
+      (with-slots (column-count
+                   column-names column-c-types column-sql-types column-data-ptrs
                    column-out-len-ptrs column-precisions column-scales
                    column-nullables-p active-p) query
         (setf (hstmt query) hstmt)
@@ -287,52 +287,52 @@ the query against." ))
           when out-len-ptr do (uffi:free-foreign-object out-len-ptr))))
 
 (defmethod db-open-query ((database odbc-db) query-expression
-                         &key arglen col-positions result-types width
-                         &allow-other-keys)
+                          &key arglen col-positions result-types width
+                          &allow-other-keys)
   (db-open-query (get-free-query database) query-expression
                  :arglen arglen :col-positions col-positions
-                :result-types result-types
-                :width (if width width (db-width database))))
+                 :result-types result-types
+                 :width (if width width (db-width database))))
 
 (defmethod db-open-query ((query odbc-query) query-expression
-                         &key arglen col-positions result-types width
-                         &allow-other-keys)
+                          &key arglen col-positions result-types width
+                          &allow-other-keys)
   (%db-execute query query-expression)
   (%initialize-query query arglen col-positions :result-types result-types
-                    :width width))
+                     :width width))
 
 (defmethod db-fetch-query-results ((database odbc-db) &optional count)
   (db-fetch-query-results (db-query-object database) count))
 
 (defmethod db-fetch-query-results ((query odbc-query) &optional count)
   (when (query-active-p query)
-    (with-slots (column-count column-data-ptrs column-c-types column-sql-types 
-                column-out-len-ptrs column-precisions hstmt computed-result-types)
-       query
+    (with-slots (column-count column-data-ptrs column-c-types column-sql-types
+                 column-out-len-ptrs column-precisions hstmt computed-result-types)
+        query
       (let* ((rows-fetched 0)
-            (rows
-             (loop for i from 0 
-                 until (or (and count (= i count))
-                           (= (%sql-fetch hstmt) odbc::$SQL_NO_DATA_FOUND))
-                 collect
-                   (loop for result-type across computed-result-types
-                       for data-ptr across column-data-ptrs
-                       for c-type across column-c-types
-                       for sql-type across column-sql-types
-                       for out-len-ptr across column-out-len-ptrs
-                       for precision across column-precisions
-                       for j from 0    ; column count is zero based in lisp
-                       collect 
-                         (progn
-                           (incf rows-fetched)
-                           (cond ((< 0 precision (query-width query))
-                                  (read-data data-ptr c-type sql-type out-len-ptr result-type))
-                                 ((zerop (get-cast-long out-len-ptr))
-                             nil)
-                                 (t
-                                  (read-data-in-chunks hstmt j data-ptr c-type sql-type
-                                                       out-len-ptr result-type))))))))
-       (values rows query rows-fetched)))))
+             (rows
+              (loop for i from 0
+                  until (or (and count (= i count))
+                            (= (%sql-fetch hstmt) odbc::$SQL_NO_DATA_FOUND))
+                  collect
+                    (loop for result-type across computed-result-types
+                        for data-ptr across column-data-ptrs
+                        for c-type across column-c-types
+                        for sql-type across column-sql-types
+                        for out-len-ptr across column-out-len-ptrs
+                        for precision across column-precisions
+                        for j from 0    ; column count is zero based in lisp
+                        collect
+                          (progn
+                            (incf rows-fetched)
+                            (cond ((< 0 precision (query-width query))
+                                   (read-data data-ptr c-type sql-type out-len-ptr result-type))
+                                  ((zerop (get-cast-long out-len-ptr))
+                              nil)
+                                  (t
+                                   (read-data-in-chunks hstmt j data-ptr c-type sql-type
+                                                        out-len-ptr result-type))))))))
+        (values rows query rows-fetched)))))
 
 (defun db-query (database query-expression &key result-types width)
   (let ((free-query (get-free-query database)))
@@ -341,13 +341,13 @@ the query against." ))
       (progn
         (%db-execute free-query query-expression)
         (%initialize-query free-query nil nil :result-types result-types :width width)
-       (if (plusp (column-count free-query)) ;; KMR: Added check for commands that don't return columns
-           (values
-            (db-fetch-query-results free-query nil)
-            (map 'list #'identity (column-names free-query)))
-         (values
-          (result-rows-count (hstmt free-query))
-          nil)))
+        (if (plusp (column-count free-query)) ;; KMR: Added check for commands that don't return columns
+            (values
+             (db-fetch-query-results free-query nil)
+             (map 'list #'identity (column-names free-query)))
+          (values
+           (result-rows-count (hstmt free-query))
+           nil)))
       (db-close-query free-query)
       )))
 
@@ -357,7 +357,7 @@ the query against." ))
 (defmethod %db-execute ((query odbc-query) sql-expression &key &allow-other-keys)
   (with-slots (henv hdbc) (odbc::query-database query)
     (with-slots (hstmt) query
-      (unless hstmt (setf hstmt (%new-statement-handle hdbc))) 
+      (unless hstmt (setf hstmt (%new-statement-handle hdbc)))
       (setf (sql-expression query) sql-expression)
       (%sql-exec-direct sql-expression hstmt henv hdbc)
       query)))
@@ -371,18 +371,18 @@ This makes the functions db-execute-command and db-query thread safe."
          (let ((inactive-query (find-if (lambda (query)
                                           (not (query-active-p query)))
                                         queries)))
-           (when inactive-query 
-             (with-slots (column-count column-names column-c-types 
-                         width hstmt
-                         column-sql-types column-data-ptrs
-                         column-out-len-ptrs column-precisions
-                         column-scales column-nullables-p)
+           (when inactive-query
+             (with-slots (column-count column-names column-c-types
+                          width hstmt
+                          column-sql-types column-data-ptrs
+                          column-out-len-ptrs column-precisions
+                          column-scales column-nullables-p)
                          inactive-query
                ;;(print column-data-ptrs tb::*local-output*)
                ;;(%dispose-column-ptrs inactive-query)
                (setf column-count 0
-                    width +max-precision+
-                    ;; KMR hstmt (%new-statement-handle hdbc)
+                     width +max-precision+
+                     ;; KMR hstmt (%new-statement-handle hdbc)
                      (fill-pointer column-names) 0
                      (fill-pointer column-c-types) 0
                      (fill-pointer column-sql-types) 0
@@ -406,22 +406,22 @@ This makes the functions db-execute-command and db-query thread safe."
 (defmethod db-execute-command ((query odbc-query) sql-string)
   (with-slots (hstmt database) query
     (with-slots (henv hdbc) database
-      (unless hstmt (setf hstmt (%new-statement-handle hdbc))) 
-      (unwind-protect 
+      (unless hstmt (setf hstmt (%new-statement-handle hdbc)))
+      (unwind-protect
           (%sql-exec-direct sql-string hstmt henv hdbc)
         (db-close-query query)))))
 
 (defmethod %initialize-query ((database odbc-db) arglen col-positions &key result-types width)
   (%initialize-query (db-query-object database) arglen col-positions
-                    :result-types result-types 
-                    :width (if width width (db-width database))))
+                     :result-types result-types
+                     :width (if width width (db-width database))))
 
 (defmethod %initialize-query ((query odbc-query) arglen col-positions &key result-types width)
   (with-slots (hstmt computed-result-types
                column-count column-names column-c-types column-sql-types
                column-data-ptrs column-out-len-ptrs column-precisions
-               column-scales column-nullables-p) 
-      query 
+               column-scales column-nullables-p)
+      query
     (setf column-count (if arglen
                          (min arglen (result-columns-count hstmt))
                          (result-columns-count hstmt)))
@@ -436,7 +436,7 @@ This makes the functions db-execute-command and db-query thread safe."
                     (if long-p ;; if long-p we fetch in chunks with %sql-get-data but must ensure that out_len_ptr is non zero
                         (setf (uffi:deref-pointer out-len-ptr #.odbc::$ODBC-LONG-TYPE) #.odbc::$SQL_NO_TOTAL)
                       (%bind-column hstmt col-nr c-type data-ptr (1+ size) out-len-ptr))
-                    (vector-push-extend name column-names) 
+                    (vector-push-extend name column-names)
                     (vector-push-extend sql-type column-sql-types)
                     (vector-push-extend (sql-to-c-type sql-type) column-c-types)
                     (vector-push-extend precision column-precisions)
@@ -450,26 +450,26 @@ This makes the functions db-execute-command and db-query thread safe."
         (dotimes (col-nr column-count)
           ;; get column information
           (initialize-column col-nr))))
-    
+
     (setf computed-result-types (make-array column-count))
     (dotimes (i column-count)
-      (setf (aref computed-result-types i) 
-       (cond
-        ((consp result-types)
-         (nth i result-types))
-        ((eq result-types :auto)
-         (if (eq (aref column-sql-types i) odbc::$SQL_BIGINT)
-             :number
-           (case (aref column-c-types i)
-             (#.odbc::$SQL_C_SLONG :int)
-             (#.odbc::$SQL_C_DOUBLE :double)
-             (#.odbc::$SQL_C_FLOAT :float)
-             (#.odbc::$SQL_C_SSHORT :short)
-             (#.odbc::$SQL_C_STINYINT :short)
-             (#.odbc::$SQL_BIGINT :short)
-             (t t))))
-         (t
-          t)))))
+      (setf (aref computed-result-types i)
+        (cond
+         ((consp result-types)
+          (nth i result-types))
+         ((eq result-types :auto)
+          (if (eq (aref column-sql-types i) odbc::$SQL_BIGINT)
+              :number
+            (case (aref column-c-types i)
+              (#.odbc::$SQL_C_SLONG :int)
+              (#.odbc::$SQL_C_DOUBLE :double)
+              (#.odbc::$SQL_C_FLOAT :float)
+              (#.odbc::$SQL_C_SSHORT :short)
+              (#.odbc::$SQL_C_STINYINT :short)
+              (#.odbc::$SQL_BIGINT :short)
+              (t t))))
+          (t
+           t)))))
   query)
 
 (defun db-close-query (query &key drop-p)
@@ -481,10 +481,10 @@ This makes the functions db-execute-command and db-query thread safe."
         (dotimes (col-nr count)
           (let ((data-ptr (aref column-data-ptrs col-nr))
                 (out-len-ptr (aref column-out-len-ptrs col-nr)))
-           (declare (ignorable data-ptr out-len-ptr))
-           ;; free-statment :unbind frees these
-           #+ignore (when data-ptr (uffi:free-foreign-object data-ptr))
-           #+ignore (when out-len-ptr (uffi:free-foreign-object out-len-ptr)))))
+            (declare (ignorable data-ptr out-len-ptr))
+            ;; free-statment :unbind frees these
+            #+ignore (when data-ptr (uffi:free-foreign-object data-ptr))
+            #+ignore (when out-len-ptr (uffi:free-foreign-object out-len-ptr)))))
       (cond ((null hstmt)
              nil)
             (drop-p
@@ -501,21 +501,21 @@ This makes the functions db-execute-command and db-query thread safe."
   (%read-query-data (db-query-object database) ignore-columns))
 
 (defmethod %read-query-data ((query odbc-query) ignore-columns)
-  (with-slots (hstmt column-count column-c-types column-sql-types 
-              column-data-ptrs column-out-len-ptrs column-precisions
-              computed-result-types)
+  (with-slots (hstmt column-count column-c-types column-sql-types
+               column-data-ptrs column-out-len-ptrs column-precisions
+               computed-result-types)
       query
     (unless (= (odbc::SQLFetch hstmt) odbc::$SQL_NO_DATA_FOUND)
       (values
-       (loop for col-nr from 0 to (- column-count 
+       (loop for col-nr from 0 to (- column-count
                                      (if (eq ignore-columns :last) 2 1))
-          for result-type across computed-result-types
-          collect
+           for result-type across computed-result-types
+           collect
              (let ((precision (aref column-precisions col-nr))
                    (sql-type (aref column-sql-types col-nr)))
                (cond ((or (< 0 precision (query-width query))
                           (and (zerop precision) (not (find sql-type '($SQL_C_CHAR)))))
-                      (read-data (aref column-data-ptrs col-nr) 
+                      (read-data (aref column-data-ptrs col-nr)
                                  (aref column-c-types col-nr)
                                  sql-type
                                  (aref column-out-len-ptrs col-nr)
@@ -524,7 +524,7 @@ This makes the functions db-execute-command and db-query thread safe."
                       *null*)
                      (t
                       (read-data-in-chunks hstmt col-nr
-                                           (aref column-data-ptrs col-nr) 
+                                           (aref column-data-ptrs col-nr)
                                            (aref column-c-types col-nr)
                                            (aref column-sql-types col-nr)
                                            (aref column-out-len-ptrs col-nr)
@@ -547,8 +547,8 @@ This makes the functions db-execute-command and db-query thread safe."
     ;; dispose of memory and set query inactive or get rid of it
     (db-close-query query)))
 
-(defun db-map-bind-query (query type function 
-                         &rest parameters)
+(defun db-map-bind-query (query type function
+                          &rest parameters)
   (declare (ignore type)) ; preliminary. Do a type coersion here
   (unwind-protect
     (progn
@@ -583,7 +583,7 @@ This makes the functions db-execute-command and db-query thread safe."
 (defmethod db-prepare-statement ((database odbc-db) sql
                                      &key parameter-table parameter-columns)
   (with-slots (hdbc) database
-    (let ((query (get-free-query database))) 
+    (let ((query (get-free-query database)))
       (with-slots (hstmt) query
         (unless hstmt (setf hstmt (%new-statement-handle hdbc))))
       (db-prepare-statement query sql parameter-table parameter-columns))))
@@ -595,8 +595,8 @@ This makes the functions db-execute-command and db-query thread safe."
   ;; support it.
   (unless (string-equal sql "insert" :end1 6)
     (error 'clsql:sql-database-error
-          (format nil
-                  "Only insert expressions are supported in literal ODBC: '~a'." sql)))
+           (format nil
+                   "Only insert expressions are supported in literal ODBC: '~a'." sql)))
   (%db-execute query (format nil "select ~{~a~^,~} from ~a where 0 = 1"
                              (or parameter-columns '("*")) parameter-table))
   (%initialize-query query nil nil)
@@ -618,14 +618,14 @@ This makes the functions db-execute-command and db-query thread safe."
                   parameter
                   (write-to-string parameter))
            size (length parameter-string)
-                data-ptr 
+                data-ptr
                 (uffi:allocate-foreign-string (1+ size)))
           (vector-push-extend data-ptr parameter-data-ptrs)
-          (%sql-bind-parameter 
+          (%sql-bind-parameter
            hstmt (1- (fill-pointer parameter-data-ptrs)) odbc::$SQL_PARAM_INPUT
            odbc::$SQL_C_CHAR ; (aref column-c-types parameter-count)
            odbc::$SQL_CHAR ; sql-type
-           (query-width query)         ;precision ; this should be the actual precision!
+           (query-width query)          ;precision ; this should be the actual precision!
            ;; scale
            0 ;; should be calculated for odbc::$SQL_DECIMAL,
            ;;$SQL_NUMERIC and odbc::$SQL_TIMESTAMP
@@ -641,7 +641,7 @@ This makes the functions db-execute-command and db-query thread safe."
 (defun %db-reset-query (query)
   (with-slots (hstmt parameter-data-ptrs) query
     (prog1
-      (db-fetch-query-results query nil) 
+      (db-fetch-query-results query nil)
       (%free-statement hstmt :reset) ;; but _not_ :unbind !
       (%free-statement hstmt :close)
       (dotimes (param-nr (fill-pointer parameter-data-ptrs))
@@ -659,12 +659,12 @@ This makes the functions db-execute-command and db-query thread safe."
 
 ;; database inquiery functions
 
-(defun db-describe-columns (database table-qualifier table-owner 
-                           table-name column-name)
+(defun db-describe-columns (database table-qualifier table-owner
+                            table-name column-name)
   (with-slots (hdbc) database
     (%describe-columns hdbc table-qualifier table-owner table-name column-name)))
 
-;; should translate info-type integers to keywords in order to make this 
+;; should translate info-type integers to keywords in order to make this
 ;; more readable?
 (defmethod get-odbc-info ((database odbc-db) info-type)
   (with-slots (hdbc info) database
@@ -683,7 +683,7 @@ This makes the functions db-execute-command and db-query thread safe."
    (let ((henv (%new-environment-handle)))
     (unwind-protect
           (loop with direction = :first
-               for data-source+description 
+               for data-source+description
                = (multiple-value-list (%sql-data-sources henv :direction direction))
                while (car data-source+description)
                collect data-source+description
index 9baec6a..2ae944d 100644 (file)
@@ -50,7 +50,7 @@
     ((hdbc sql-handle)          ; HDBC        hdbc
      (*szDSN :cstring)        ; UCHAR  FAR *szDSN
      (cbDSN :short)             ; SWORD       cbDSN
-     (*szUID :cstring)        ; UCHAR  FAR *szUID 
+     (*szUID :cstring)        ; UCHAR  FAR *szUID
      (cbUID :short)             ; SWORD       cbUID
      (*szAuthStr :cstring)    ; UCHAR  FAR *szAuthStr
      (cbAuthStr :short)         ; SWORD       cbAuthStr
@@ -75,7 +75,7 @@
     ((hdbc sql-handle))         ; HDBC        hdbc
   :module "odbc"
   :returning :short)              ; RETCODE_SQL_API
-  
+
 ;; deprecated
 (def-function "SQLAllocStmt"
     ((hdbc sql-handle)          ; HDBC        hdbc
   :module "odbc"
   :returning :short)              ; RETCODE_SQL_API
 
-                                       ; level 2
+                                        ; level 2
 (def-function "SQLExtendedFetch"
     ((hstmt sql-handle)         ; HSTMT       hstmt
      (fFetchType :short)        ; UWORD       fFetchType
 
 ;;; foreign type definitions
 
-;;(defmacro %sql-len-data-at-exec (length) 
+;;(defmacro %sql-len-data-at-exec (length)
 ;;  `(- $SQL_LEN_DATA_AT_EXEC_OFFSET ,length))
 
 
-(def-struct sql-c-time 
+(def-struct sql-c-time
     (hour   :short)
   (minute :short)
   (second :short))
     (year  :short)
   (month :short)
   (day   :short))
-  
+
 (def-struct sql-c-timestamp
     (year     :short)
   (month    :short)
index b63a25a..5d58719 100644 (file)
@@ -18,9 +18,9 @@
 
 (in-package #:odbc)
 
-(defparameter *odbc-library-filenames* 
+(defparameter *odbc-library-filenames*
   '("odbc32" "libodbc" "libiodbc"))
-  
+
 (defvar *odbc-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
 load the Odbc client library succesfully.  If this differs at your site,
@@ -31,7 +31,7 @@ set to the right path before compiling or loading the system.")
 
 (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :odbc)))
   *odbc-library-loaded*)
-                                     
+
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :odbc)))
   (clsql-uffi:find-and-load-foreign-library *odbc-library-filenames*
                                             :module "odbc")
index 011b6b4..668fd9a 100644 (file)
@@ -20,7 +20,7 @@
 
 (defpackage #:odbc
   (:use #:cl #:uffi)
-  (:export 
+  (:export
      #:database-library-loaded
 
      #:*null*
index e76b9d0..79fd4a5 100644 (file)
@@ -29,7 +29,7 @@
   ((odbc-db-type :accessor database-odbc-db-type)))
 
 (defmethod database-name-from-spec (connection-spec
-                                   (database-type (eql :odbc)))
+                                    (database-type (eql :odbc)))
   (check-connection-spec connection-spec database-type (dsn user password &key connection-string completion window-handle))
   (destructuring-bind (dsn user password &key connection-string completion window-handle) connection-spec
     (declare (ignore password connection-string completion window-handle))
   (check-connection-spec connection-spec database-type (dsn user password &key connection-string completion window-handle))
   (destructuring-bind (dsn user password &key connection-string (completion :no-prompt) window-handle) connection-spec
     (handler-case
-       (let ((db (make-instance 'odbc-database
-                                :name (database-name-from-spec connection-spec :odbc)
-                                :database-type :odbc
-                                :dbi-package (find-package '#:odbc-dbi)
-                                :odbc-conn
-                                (odbc-dbi:connect :user user
-                                                  :password password
-                                                  :data-source-name dsn
+        (let ((db (make-instance 'odbc-database
+                                 :name (database-name-from-spec connection-spec :odbc)
+                                 :database-type :odbc
+                                 :dbi-package (find-package '#:odbc-dbi)
+                                 :odbc-conn
+                                 (odbc-dbi:connect :user user
+                                                   :password password
+                                                   :data-source-name dsn
                                                    :connection-string connection-string
                                                    :completion completion
                                                    :window-handle window-handle))))
-         (store-type-of-connected-database db)
-         ;; Ensure this database type is initialized so can check capabilities of
-         ;; underlying database
-         (initialize-database-type :database-type database-type)
-         db)
+          (store-type-of-connected-database db)
+          ;; Ensure this database type is initialized so can check capabilities of
+          ;; underlying database
+          (initialize-database-type :database-type database-type)
+          db)
       #+ignore
-      (error ()        ;; Init or Connect failed
-       (error 'sql-connection-error
-              :database-type database-type
-              :connection-spec connection-spec
-              :message "Connection failed")))))
+      (error ()         ;; Init or Connect failed
+        (error 'sql-connection-error
+               :database-type database-type
+               :connection-spec connection-spec
+               :message "Connection failed")))))
 
 (defmethod database-underlying-type ((database odbc-database))
   (database-odbc-db-type database))
 
 (defun store-type-of-connected-database (db)
   (let* ((odbc-conn (clsql-sys::odbc-conn db))
-        (server-name (odbc-dbi::get-odbc-info odbc-conn odbc::$SQL_SERVER_NAME))
-        (dbms-name (odbc-dbi::get-odbc-info odbc-conn odbc::$SQL_DBMS_NAME))
-        (type
-         ;; need SERVER-NAME and DBMS-NAME because many drivers mix this up
-         (cond 
-          ((or (search "postgresql" server-name :test #'char-equal)
-               (search "postgresql" dbms-name :test #'char-equal))
-           (unless (find-package 'clsql-postgresql)
-             (ignore-errors (asdf:operate 'asdf:load-op 'clsql-postgresql-socket)))
-           :postgresql)
+         (server-name (odbc-dbi::get-odbc-info odbc-conn odbc::$SQL_SERVER_NAME))
+         (dbms-name (odbc-dbi::get-odbc-info odbc-conn odbc::$SQL_DBMS_NAME))
+         (type
+          ;; need SERVER-NAME and DBMS-NAME because many drivers mix this up
+          (cond
+           ((or (search "postgresql" server-name :test #'char-equal)
+                (search "postgresql" dbms-name :test #'char-equal))
+            (unless (find-package 'clsql-postgresql)
+              (ignore-errors (asdf:operate 'asdf:load-op 'clsql-postgresql-socket)))
+            :postgresql)
            ((or (search "Microsoft SQL Server" server-name :test #'char-equal)
                 (search "Microsoft SQL Server" dbms-name :test #'char-equal))
             :mssql)
-          ((or (search "mysql" server-name :test #'char-equal)
-               (search "mysql" dbms-name :test #'char-equal))
-           (unless (find-package 'clsql-mysql)
-             ;; ignore errors on platforms where the shared libraries are not available
-             (ignore-errors (asdf:operate 'asdf:load-op 'clsql-mysql)))
-           :mysql)
-          ((or (search "oracle" server-name :test #'char-equal)
-               (search "oracle" dbms-name :test #'char-equal))
-           :oracle))))
+           ((or (search "mysql" server-name :test #'char-equal)
+                (search "mysql" dbms-name :test #'char-equal))
+            (unless (find-package 'clsql-mysql)
+              ;; ignore errors on platforms where the shared libraries are not available
+              (ignore-errors (asdf:operate 'asdf:load-op 'clsql-mysql)))
+            :mysql)
+           ((or (search "oracle" server-name :test #'char-equal)
+                (search "oracle" dbms-name :test #'char-equal))
+            :oracle))))
     (setf (database-odbc-db-type db) type)))
-  
+
 
 
 (defmethod database-create (connection-spec (type (eql :odbc)))
 
 (defmethod database-probe (connection-spec (type (eql :odbc)))
   (when (find (car connection-spec) (database-list connection-spec type)
-             :test #'string-equal)
+              :test #'string-equal)
     t))
 
 (defmethod database-list (connection-spec (type (eql :odbc)))
   (let ((result '()))
     (dolist (table (database-list-tables database :owner owner) result)
       (setq result
-       (append (database-list-table-indexes table database :owner owner)
-               result)))))
+        (append (database-list-table-indexes table database :owner owner)
+                result)))))
 
 (defmethod database-list-table-indexes (table (database odbc-database)
-                                       &key (owner nil))
+                                        &key (owner nil))
   (declare (ignore owner))
   (multiple-value-bind (rows col-names)
-      (odbc-dbi:list-table-indexes 
+      (odbc-dbi:list-table-indexes
        table
        :db (clsql-sys::odbc-conn database))
     (declare (ignore col-names))
     ;; INDEX_NAME is hard-coded in sixth position by ODBC driver
     ;; FIXME: ??? is hard-coded in the fourth position
     (do ((results nil)
-        (loop-rows rows (cdr loop-rows)))
-       ((null loop-rows) (nreverse results))
+         (loop-rows rows (cdr loop-rows)))
+        ((null loop-rows) (nreverse results))
       (let* ((row (car loop-rows))
-            (col (nth 5 row)))
-       (unless (or (null col) (find col results :test #'string-equal))
-         (push col results))))))
+             (col (nth 5 row)))
+        (unless (or (null col) (find col results :test #'string-equal))
+          (push col results))))))
 
 ;;; Database capabilities
 
index badfedc..fe6986b 100644 (file)
 
 (defstruct (foreign-resource)
   (type (error "Missing TYPE.")
-       :read-only t)
+        :read-only t)
   (sizeof (error "Missing SIZEOF.")
-         :read-only t)
+          :read-only t)
   (buffer (error "Missing BUFFER.")
-         :read-only t)
+          :read-only t)
   (in-use nil :type boolean))
 
 
 (defun %get-resource (type sizeof)
   (let ((resources (gethash type *foreign-resource-hash*)))
     (car (member-if
-         #'(lambda (res)
-             (and (= (foreign-resource-sizeof res) sizeof)
-                  (not (foreign-resource-in-use res))))
-         resources))))
+          #'(lambda (res)
+              (and (= (foreign-resource-sizeof res) sizeof)
+                   (not (foreign-resource-in-use res))))
+          resources))))
 
 (defun %insert-foreign-resource (type res)
   (let ((resource (gethash type *foreign-resource-hash*)))
     (setf (gethash type *foreign-resource-hash*)
-         (cons res resource))))
+          (cons res resource))))
 
 (defmacro acquire-foreign-resource (type &optional size)
   `(let ((res (%get-resource ,type ,size)))
      (unless res
        (setf res (make-foreign-resource
-                 :type ,type :sizeof ,size
-                 :buffer (uffi:allocate-foreign-object ,type ,size)))
+                  :type ,type :sizeof ,size
+                  :buffer (uffi:allocate-foreign-object ,type ,size)))
        (%insert-foreign-resource ',type res))
      (claim-foreign-resource res)))
-              
+
 (defun free-foreign-resource (ares)
   (setf (foreign-resource-in-use ares) nil)
   ares)
index 19b3f6e..d51050b 100644 (file)
   ((c-oci-symbol lisp-oci-fn) c-return &rest c-parms)
   (let ((ll (mapcar (lambda (x) (declare (ignore x)) (gensym)) c-parms)))
     `(let ((%lisp-oci-fn (uffi:def-function (,c-oci-symbol ,(intern (concatenate 'string "%" (symbol-name lisp-oci-fn))))
-                            ,c-parms
-                          :returning ,c-return)))
+                             ,c-parms
+                           :returning ,c-return)))
        (defun ,lisp-oci-fn (,@ll &key database nulls-ok)
          (declare (ignore database nulls-ok))
-        (funcall %lisp-oci-fn ,@ll)))))
+         (funcall %lisp-oci-fn ,@ll)))))
 
 
 (def-oci-routine ("OCIInitialize" oci-initialize)
     :int
-  (mode ub4)                                   ; ub4
-  (ctxp :pointer-void)                 ; dvoid *
-  (malocfp :pointer-void)                      ; dvoid *(*)
-  (ralocfp :pointer-void)                      ; dvoid *(*)
-  (mfreefp (* :pointer-void)))         ; void *(*)
+  (mode ub4)                                    ; ub4
+  (ctxp :pointer-void)                  ; dvoid *
+  (malocfp :pointer-void)                       ; dvoid *(*)
+  (ralocfp :pointer-void)                       ; dvoid *(*)
+  (mfreefp (* :pointer-void)))          ; void *(*)
 
 
 (def-oci-routine ("OCIEnvInit" oci-env-init)
     :int
   (envpp :pointer-void)                         ; OCIEnv **
-  (mode ub4)                                   ; ub4
+  (mode ub4)                                    ; ub4
   (xtramem-sz size_t)            ; size_t
   (usermempp (* :pointer-void)))                    ; dvoid **
 
 
 (def-oci-routine ("OCIHandleAlloc" oci-handle-alloc)
     :int
-  (parenth      :pointer-void)                 ; const dvoid *
-  (hndlpp       (* :pointer-void))             ; dvoid **
-  (type         ub4)                           ; ub4
-  (xtramem_sz   size_t)                                ; size_t
-  (usrmempp     (* :pointer-void)))            ; dvoid **
+  (parenth      :pointer-void)                  ; const dvoid *
+  (hndlpp       (* :pointer-void))              ; dvoid **
+  (type         ub4)                            ; ub4
+  (xtramem_sz   size_t)                         ; size_t
+  (usrmempp     (* :pointer-void)))             ; dvoid **
 
 (def-oci-routine ("OCIServerAttach" oci-server-attach)
     :int
   (srvhp        :pointer-void)                  ; oci-server
   (errhp        :pointer-void)                  ; oci-error
-  (dblink       :cstring)                      ; :in
-  (dblink-len   sb4)                           ; sb4
-  (mode         ub4))                          ; ub4
+  (dblink       :cstring)                       ; :in
+  (dblink-len   sb4)                            ; sb4
+  (mode         ub4))                           ; ub4
 
 
 (def-oci-routine ("OCIHandleFree" oci-handle-free)
 
 (def-oci-routine ("OCILogon" oci-logon)
     :int
-  (envhp        :pointer-void)         ; env
-  (errhp        :pointer-void)         ; err
-  (svchpp       (* :pointer-void))     ; svc
-  (username     (* :unsigned-char))    ; username
-  (uname-len    ub4)                   ;
-  (passwd       (* :unsigned-char))    ; passwd
-  (password-len ub4)                   ;
-  (dsn          (* :unsigned-char))    ; datasource
-  (dsn-len      ub4))                  ;
+  (envhp        :pointer-void)          ; env
+  (errhp        :pointer-void)          ; err
+  (svchpp       (* :pointer-void))      ; svc
+  (username     (* :unsigned-char))     ; username
+  (uname-len    ub4)                    ;
+  (passwd       (* :unsigned-char))     ; passwd
+  (password-len ub4)                    ;
+  (dsn          (* :unsigned-char))     ; datasource
+  (dsn-len      ub4))                   ;
 
 (def-oci-routine ("OCILogoff" oci-logoff)
     :int
-  (p0  :pointer-void)        ; svc
-  (p1  :pointer-void))       ; err
+  (p0   :pointer-void)        ; svc
+  (p1   :pointer-void))       ; err
 
 (declaim (inline oci-error-get))
 (uffi:def-function ("OCIErrorGet" oci-error-get)
 ;;; for setting up global environment.
 
 (uffi:def-function "OCIInitialize"
-    ((mode ub4)                                        ; ub4
-     (ctxp :pointer-void)                      ; dvoid *
-     (malocfp :pointer-void)                   ; dvoid *(*)
-     (ralocfp :pointer-void)                   ; dvoid *(*)
+    ((mode ub4)                                 ; ub4
+     (ctxp :pointer-void)                       ; dvoid *
+     (malocfp :pointer-void)                    ; dvoid *(*)
+     (ralocfp :pointer-void)                    ; dvoid *(*)
      (mfreefp (* :pointer-void)))
   :returning :int)
 
 (uffi:def-function "OCIEnvInit"
-    ((envpp :pointer-void)                     ; OCIEnv **
-     (mode ub4)                                        ; ub4
-     (xtramem-sz size_t)                       ; size_t
+    ((envpp :pointer-void)                      ; OCIEnv **
+     (mode ub4)                                 ; ub4
+     (xtramem-sz size_t)                        ; size_t
      (usermempp (* :pointer-void)))
   :returning :int)
 
 
 (uffi:def-function "OCIHandleAlloc"
-    ((parenth      :pointer-void)              ; const dvoid *
-     (hndlpp       (* :pointer-void))          ; dvoid **
-     (type         ub4)                                ; ub4
-     (xtramem_sz   size_t)                     ; size_t
+    ((parenth      :pointer-void)               ; const dvoid *
+     (hndlpp       (* :pointer-void))           ; dvoid **
+     (type         ub4)                         ; ub4
+     (xtramem_sz   size_t)                      ; size_t
      (usrmempp     (* :pointer-void)))
   :returning :int)
 
 (defvar *oci-env* nil)
 
 (defvar *oci-handle-types*
-  '(:error                             ; error report handle (OCIError)
-    :service-context                   ; service context handle (OCISvcCtx)
-    :statement                         ; statement (application request) handle (OCIStmt)
-    :describe                          ; select list description handle (OCIDescribe)
-    :server                            ; server context handle (OCIServer)
-    :session                           ; user session handle (OCISession)
-    :transaction                       ; transaction context handle (OCITrans)
-    :complex-object                    ; complex object retrieval handle (OCIComplexObject)
-    :security))                                ; security handle (OCISecurity)
+  '(:error                              ; error report handle (OCIError)
+    :service-context                    ; service context handle (OCISvcCtx)
+    :statement                          ; statement (application request) handle (OCIStmt)
+    :describe                           ; select list description handle (OCIDescribe)
+    :server                             ; server context handle (OCIServer)
+    :session                            ; user session handle (OCISession)
+    :transaction                        ; transaction context handle (OCITrans)
+    :complex-object                     ; complex object retrieval handle (OCIComplexObject)
+    :security))                         ; security handle (OCISecurity)
 
 
 
 (defun oci-init (&key (mode +oci-default+))
   (let ((x (OCIInitialize mode +null-void-pointer+ +null-void-pointer+
-                         +null-void-pointer+ +null-void-pointer-pointer+)))
+                          +null-void-pointer+ +null-void-pointer-pointer+)))
     (if (= x 0)
-       (let ((env (uffi:allocate-foreign-object :pointer-void)))
-         (setq *oci-initialized* mode)
-         (let ((x (OCIEnvInit env +oci-default+ 0 +null-void-pointer+)))
-           (format t ";; OEI: returned ~d~%" x)
-           (setq *oci-env* env))))))
+        (let ((env (uffi:allocate-foreign-object :pointer-void)))
+          (setq *oci-initialized* mode)
+          (let ((x (OCIEnvInit env +oci-default+ 0 +null-void-pointer+)))
+            (format t ";; OEI: returned ~d~%" x)
+            (setq *oci-env* env))))))
 
 (defun oci-check-return (value)
   (when (= value +oci-invalid-handle+)
     (:error
      (let ((ptr (uffi:allocate-foreign-object :pointer-void)))
        (let ((x (OCIHandleAlloc
-                (uffi:deref-pointer *oci-env* void-pointer)
-                ptr
-                +oci-default+
-                0
-                +null-void-pointer-pointer+)))
-        (oci-check-return x)
-        ptr)))
+                 (uffi:deref-pointer *oci-env* void-pointer)
+                 ptr
+                 +oci-default+
+                 0
+                 +null-void-pointer-pointer+)))
+         (oci-check-return x)
+         ptr)))
     (:service-context
      "OCISvcCtx")
     (:statement
      "OCISecurity")
     (t
      (error 'sql-database-error
-           :message
-           (format nil "'~s' is not a valid OCI handle type" type)))))
+            :message
+            (format nil "'~s' is not a valid OCI handle type" type)))))
 
 (defun oci-environment ()
   (let ((envhp (oci-get-handle :type :env)))
index 692b55b..9462bfc 100644 (file)
 
 (in-package #:clsql-oracle)
 
-(defconstant +oci-default+     #x00)   ; default value for parameters and attributes
-(defconstant +oci-threaded+    #x01)   ; application is in threaded environment
-(defconstant +oci-object+      #x02)   ; the application is in object environment
-(defconstant +oci-non-blocking+ #x04)  ; non blocking mode of operation
-(defconstant +oci-env-no-mutex+ #x08)  ; the environment handle will not be protected by a mutex internally
+(defconstant +oci-default+      #x00)   ; default value for parameters and attributes
+(defconstant +oci-threaded+     #x01)   ; application is in threaded environment
+(defconstant +oci-object+       #x02)   ; the application is in object environment
+(defconstant +oci-non-blocking+ #x04)   ; non blocking mode of operation
+(defconstant +oci-env-no-mutex+ #x08)   ; the environment handle will not be protected by a mutex internally
 
 ;; Handle types
 
-(defconstant +oci-htype-env+   1)      ; environment handle
-(defconstant +oci-htype-error+ 2)      ; error handle
-(defconstant +oci-htype-svcctx+ 3)     ; service handle
-(defconstant +oci-htype-stmt+  4)      ; statement handle
-(defconstant +oci-htype-bind+  5)      ; bind handle
-(defconstant +oci-htype-define+ 6)     ; define handle
-(defconstant +oci-htype-describe+ 7)   ; describe handle
-(defconstant +oci-htype-server+ 8)     ; server handle
-(defconstant +oci-htype-session+ 9)    ; authentication handle
-(defconstant +oci-htype-trans+ 10)     ; transaction handle
+(defconstant +oci-htype-env+    1)      ; environment handle
+(defconstant +oci-htype-error+  2)      ; error handle
+(defconstant +oci-htype-svcctx+ 3)      ; service handle
+(defconstant +oci-htype-stmt+   4)      ; statement handle
+(defconstant +oci-htype-bind+   5)      ; bind handle
+(defconstant +oci-htype-define+ 6)      ; define handle
+(defconstant +oci-htype-describe+ 7)    ; describe handle
+(defconstant +oci-htype-server+ 8)      ; server handle
+(defconstant +oci-htype-session+ 9)     ; authentication handle
+(defconstant +oci-htype-trans+  10)     ; transaction handle
 (defconstant +oci-htype-complexobject+ 11) ; complex object retrieval handle
-(defconstant +oci-htype-security+ 12)  ; security handle
+(defconstant +oci-htype-security+ 12)   ; security handle
 
 ;; Descriptor types
 
-(defconstant +oci-dtype-lob+              50) ; lob locator
-(defconstant +oci-dtype-snap+             51) ; snapshot
-(defconstant +oci-dtype-rset+             52) ; result set
-(defconstant +oci-dtype-param+            53) ; parameter descriptor obtained from ocigparm
+(defconstant +oci-dtype-lob+               50) ; lob locator
+(defconstant +oci-dtype-snap+              51) ; snapshot
+(defconstant +oci-dtype-rset+              52) ; result set
+(defconstant +oci-dtype-param+             53) ; parameter descriptor obtained from ocigparm
 (defconstant +oci-dtype-rowid+             54) ; rowid
 (defconstant +oci-dtype-complexobjectcomp+ 55) ; complex object retrieval descriptor
-(defconstant +oci-dtype-file+             56) ; File Lob locator
+(defconstant +oci-dtype-file+              56) ; File Lob locator
 (defconstant +oci-dtype-aqenq-options+     57) ; enqueue options
 (defconstant +oci-dtype-aqdeq-options+     58) ; dequeue options
 (defconstant +oci-dtype-aqmsg-properties+  59) ; message properties
@@ -53,9 +53,9 @@
 
 ;; Objectr pointer types
 
-(defconstant +oci-otype-name+  1)      ; object name
-(defconstant +oci-otype-ref+   2)      ; REF to TDO
-(defconstant +oci-otype-ptr+   3)      ; PTR to TDO
+(defconstant +oci-otype-name+   1)      ; object name
+(defconstant +oci-otype-ref+    2)      ; REF to TDO
+(defconstant +oci-otype-ptr+    3)      ; PTR to TDO
 
 ;; Attribute types
 
 ;; AQ Attribute Types
 ;; Enqueue Options
 
-(defconstant +oci-attr-visibility+ 47) ; visibility
+(defconstant +oci-attr-visibility+ 47)  ; visibility
 (defconstant +oci-attr-relative-msgid+ 48) ; relative message id
 (defconstant +oci-attr-sequence-deviation+ 49) ; sequence deviation
 
 ; - Dequeue Options -
     ; consumer name
 ;#define OCI-ATTR-DEQ-MODE 50
-;(defconstant +OCI-ATTR-CONSUMER-NAME          50              + 51)                ; dequeue mode
-;#define OCI-ATTR-NAVIGATION           52                     ; navigation
-;#define OCI-ATTR-WAIT                 53                           ; wait
-;#define OCI-ATTR-DEQ-MSGID            54             ; dequeue message id
+;(defconstant +OCI-ATTR-CONSUMER-NAME           50              + 51)                ; dequeue mode
+;#define OCI-ATTR-NAVIGATION            52                     ; navigation
+;#define OCI-ATTR-WAIT                  53                           ; wait
+;#define OCI-ATTR-DEQ-MSGID             54             ; dequeue message id
 
 ; - Message Properties -
-(defconstant +OCI-ATTR-PRIORITY+ 55)   ; priority
-(defconstant +OCI-ATTR-DELAY+ 56)      ; delay
-(defconstant +OCI-ATTR-EXPIRATION+ 57) ; expiration
-(defconstant +OCI-ATTR-CORRELATION+ 58)        ; correlation id
-(defconstant +OCI-ATTR-ATTEMPTS+ 59)   ; # of attempts
+(defconstant +OCI-ATTR-PRIORITY+ 55)    ; priority
+(defconstant +OCI-ATTR-DELAY+ 56)       ; delay
+(defconstant +OCI-ATTR-EXPIRATION+ 57)  ; expiration
+(defconstant +OCI-ATTR-CORRELATION+ 58) ; correlation id
+(defconstant +OCI-ATTR-ATTEMPTS+ 59)    ; # of attempts
 (defconstant +OCI-ATTR-RECIPIENT-LIST+ 60) ; recipient list
 (defconstant +OCI-ATTR-EXCEPTION-QUEUE+ 61) ; exception queue name
-(defconstant +OCI-ATTR-ENQ-TIME+ 62)   ; enqueue time (only OCIAttrGet)
-(defconstant +OCI-ATTR-MSG-STATE+ 63)  ; message state (only OCIAttrGet)
+(defconstant +OCI-ATTR-ENQ-TIME+ 62)    ; enqueue time (only OCIAttrGet)
+(defconstant +OCI-ATTR-MSG-STATE+ 63)   ; message state (only OCIAttrGet)
 
 ;; AQ Agent
-(defconstant +OCI-ATTR-AGENT-NAME+ 64) ; agent name
+(defconstant +OCI-ATTR-AGENT-NAME+ 64)  ; agent name
 (defconstant +OCI-ATTR-AGENT-ADDRESS+ 65) ; agent address
 (defconstant +OCI-ATTR-AGENT-PROTOCOL+ 66) ; agent protocol
 
 ;- Server handle -
-(defconstant +OCI-ATTR-NATIVE-FDES+ 67)        ; native cncxn file desc
+(defconstant +OCI-ATTR-NATIVE-FDES+ 67) ; native cncxn file desc
 
 ;-Parameter Attribute Types-
 
-(defconstant +OCI-ATTR-UNK+ 101)       ; unknown attribute
-(defconstant +OCI-ATTR-NUM-COLS+ 102)  ; number of columns
+(defconstant +OCI-ATTR-UNK+ 101)        ; unknown attribute
+(defconstant +OCI-ATTR-NUM-COLS+ 102)   ; number of columns
 (defconstant +OCI-ATTR-LIST-COLUMNS+ 103) ; parameter of the column list
-(defconstant +OCI-ATTR-RDBA+ 104)      ; DBA of the segment header
-(defconstant +OCI-ATTR-CLUSTERED+ 105) ; whether the table is clustered
+(defconstant +OCI-ATTR-RDBA+ 104)       ; DBA of the segment header
+(defconstant +OCI-ATTR-CLUSTERED+ 105)  ; whether the table is clustered
 (defconstant +OCI-ATTR-PARTITIONED+ 106) ; whether the table is partitioned
-(defconstant +OCI-ATTR-INDEX-ONLY+ 107)        ; whether the table is index only
+(defconstant +OCI-ATTR-INDEX-ONLY+ 107) ; whether the table is index only
 (defconstant +OCI-ATTR-LIST-ARGUMENTS+ 108) ; parameter of the argument list
 (defconstant +OCI-ATTR-LIST-SUBPROGRAMS+ 109) ; parameter of the subprogram list
-(defconstant +OCI-ATTR-REF-TDO+ 110)   ; REF to the type descriptor
-(defconstant +OCI-ATTR-LINK+ 111)      ; the database link name
-(defconstant +OCI-ATTR-MIN+ 112)       ; minimum value
-(defconstant +OCI-ATTR-MAX+ 113)       ; maximum value
-(defconstant +OCI-ATTR-INCR+ 114)      ; increment value
-(defconstant +OCI-ATTR-CACHE+ 115)     ; number of sequence numbers cached
-(defconstant +OCI-ATTR-ORDER+ 116)     ; whether the sequence is ordered
-(defconstant +OCI-ATTR-HW-MARK+ 117)   ; high-water mark
+(defconstant +OCI-ATTR-REF-TDO+ 110)    ; REF to the type descriptor
+(defconstant +OCI-ATTR-LINK+ 111)       ; the database link name
+(defconstant +OCI-ATTR-MIN+ 112)        ; minimum value
+(defconstant +OCI-ATTR-MAX+ 113)        ; maximum value
+(defconstant +OCI-ATTR-INCR+ 114)       ; increment value
+(defconstant +OCI-ATTR-CACHE+ 115)      ; number of sequence numbers cached
+(defconstant +OCI-ATTR-ORDER+ 116)      ; whether the sequence is ordered
+(defconstant +OCI-ATTR-HW-MARK+ 117)    ; high-water mark
 (defconstant +OCI-ATTR-TYPE-SCHEMA+ 118) ; type's schema name
-(defconstant +OCI-ATTR-TIMESTAMP+ 119) ; timestamp of the object
-(defconstant +OCI-ATTR-NUM-ATTRS+ 120) ; number of sttributes
-(defconstant +OCI-ATTR-NUM-PARAMS+ 121)        ; number of parameters
-(defconstant +OCI-ATTR-OBJID+ 122)     ; object id for a table or view
-(defconstant +OCI-ATTR-PTYPE+ 123)     ; type of info described by
-(defconstant +OCI-ATTR-PARAM+ 124)     ; parameter descriptor
+(defconstant +OCI-ATTR-TIMESTAMP+ 119)  ; timestamp of the object
+(defconstant +OCI-ATTR-NUM-ATTRS+ 120)  ; number of sttributes
+(defconstant +OCI-ATTR-NUM-PARAMS+ 121) ; number of parameters
+(defconstant +OCI-ATTR-OBJID+ 122)      ; object id for a table or view
+(defconstant +OCI-ATTR-PTYPE+ 123)      ; type of info described by
+(defconstant +OCI-ATTR-PARAM+ 124)      ; parameter descriptor
 (defconstant +OCI-ATTR-OVERLOAD-ID+ 125) ; overload ID for funcs and procs
-(defconstant +OCI-ATTR-TABLESPACE+ 126)        ; table name space
-(defconstant +OCI-ATTR-TDO+ 127)       ; TDO of a type
-(defconstant +OCI-ATTR-PARSE-ERROR-OFFSET+ 128)        ; Parse Error offset
+(defconstant +OCI-ATTR-TABLESPACE+ 126) ; table name space
+(defconstant +OCI-ATTR-TDO+ 127)        ; TDO of a type
+(defconstant +OCI-ATTR-PARSE-ERROR-OFFSET+ 128) ; Parse Error offset
 ;-Credential Types-
-(defconstant +OCI-CRED-RDBMS+ 1)       ; database username/password
-(defconstant +OCI-CRED-EXT+ 2)         ; externally provided credentials
+(defconstant +OCI-CRED-RDBMS+ 1)        ; database username/password
+(defconstant +OCI-CRED-EXT+ 2)          ; externally provided credentials
 
 ;; Error Return Values-
 
-(defconstant +oci-continue+             -24200)        ; Continue with the body of the OCI function
+(defconstant +oci-continue+             -24200) ; Continue with the body of the OCI function
 (defconstant +oci-still-executing+       -3123) ; OCI would block error
-(defconstant +oci-invalid-handle+           -2)        ; maps to SQL-INVALID-HANDLE
+(defconstant +oci-invalid-handle+           -2) ; maps to SQL-INVALID-HANDLE
 (defconstant +oci-error+                    -1) ; maps to SQL-ERROR
 (defconstant +oci-success+                   0) ; maps to SQL-SUCCESS of SAG CLI
 (defconstant +oci-success-with-info+         1) ; maps to SQL-SUCCESS-WITH-INFO
-(defconstant +oci-need-data+                99)        ; maps to SQL-NEED-DATA
+(defconstant +oci-need-data+                99) ; maps to SQL-NEED-DATA
 (defconstant +oci-no-data+                 100) ; maps to SQL-NO-DATA
 
 ;; Parsing Syntax Types-
 
-(defconstant +oci-ntv-syntax+ 1)       ; Use what so ever is the native lang of server
-(defconstant +oci-v7-syntax+ 2)                ; V7 language
-(defconstant +oci-v8-syntax+ 3)                ; V8 language
+(defconstant +oci-ntv-syntax+ 1)        ; Use what so ever is the native lang of server
+(defconstant +oci-v7-syntax+ 2)         ; V7 language
+(defconstant +oci-v8-syntax+ 3)         ; V8 language
 
 ;-Scrollable Cursor Options-
 
 
 ;-Bind and Define Options-
 
-(defconstant +OCI-SB2-IND-PTR+ #x01)   ; unused
-(defconstant +OCI-DATA-AT-EXEC+ #x02)  ; data at execute time
-(defconstant +OCI-DYNAMIC-FETCH+ #x02) ; fetch dynamically
-(defconstant +OCI-PIECEWISE+ #x04)     ; piecewise DMLs or fetch
+(defconstant +OCI-SB2-IND-PTR+ #x01)    ; unused
+(defconstant +OCI-DATA-AT-EXEC+ #x02)   ; data at execute time
+(defconstant +OCI-DYNAMIC-FETCH+ #x02)  ; fetch dynamically
+(defconstant +OCI-PIECEWISE+ #x04)      ; piecewise DMLs or fetch
 ;-
 
 ;-Execution Modes-
-(defconstant +OCI-BATCH-MODE+ #x01)    ; batch the oci statement for execution
-(defconstant +OCI-EXACT-FETCH+ #x02)   ; fetch the exact rows specified
+(defconstant +OCI-BATCH-MODE+ #x01)     ; batch the oci statement for execution
+(defconstant +OCI-EXACT-FETCH+ #x02)    ; fetch the exact rows specified
 (defconstant +OCI-KEEP-FETCH-STATE+ #x04) ; unused
 (defconstant +OCI-SCROLLABLE-CURSOR+ #x08) ; cursor scrollable
-(defconstant +OCI-DESCRIBE-ONLY+ #x10) ; only describe the statement
+(defconstant +OCI-DESCRIBE-ONLY+ #x10)  ; only describe the statement
 (defconstant +OCI-COMMIT-ON-SUCCESS+ #x20) ; commit, if successful execution
 ;-
 
 ;-Authentication Modes-
-(defconstant +OCI-MIGRATE+ #x0001)     ; migratable auth context
-(defconstant +OCI-SYSDBA+ #x0002)      ; for SYSDBA authorization
-(defconstant +OCI-SYSOPER+ #x0004)     ; for SYSOPER authorization
-(defconstant +OCI-PRELIM-AUTH+ #x0008) ; for preliminary authorization
+(defconstant +OCI-MIGRATE+ #x0001)      ; migratable auth context
+(defconstant +OCI-SYSDBA+ #x0002)       ; for SYSDBA authorization
+(defconstant +OCI-SYSOPER+ #x0004)      ; for SYSOPER authorization
+(defconstant +OCI-PRELIM-AUTH+ #x0008)  ; for preliminary authorization
 ;-
 
 ;-Piece Information-
-(defconstant +OCI-PARAM-IN+ #x01)      ; in parameter
-(defconstant +OCI-PARAM-OUT+ #x02)     ; out parameter
+(defconstant +OCI-PARAM-IN+ #x01)       ; in parameter
+(defconstant +OCI-PARAM-OUT+ #x02)      ; out parameter
 ;-
 
 ;- Transaction Start Flags -
 (defconstant +OCI-TRANS-JOIN+ #x00000002) ; join an existing transaction
 (defconstant +OCI-TRANS-RESUME+ #x00000004) ; resume this transaction
 (defconstant +OCI-TRANS-STARTMASK+ #x000000ff)
-  
-  
+
+
 (defconstant +OCI-TRANS-READONLY+ #x00000100) ; starts a readonly transaction
 (defconstant +OCI-TRANS-READWRITE+ #x00000200) ; starts a read-write transaction
 (defconstant +OCI-TRANS-SERIALIZABLE+ #x00000400)
-                                       ; starts a serializable transaction
+                                        ; starts a serializable transaction
 (defconstant +OCI-TRANS-ISOLMASK+ #x0000ff00)
 
 (defconstant +OCI-TRANS-LOOSE+ #x00010000) ; a loosely coupled branch
 ;; NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
 
 ; - Visibility flags -
-(defconstant +OCI-ENQ-IMMEDIATE+ 1)    ; enqueue is an independent transaction
-(defconstant +OCI-ENQ-ON-COMMIT+ 2)    ; enqueue is part of current transaction
+(defconstant +OCI-ENQ-IMMEDIATE+ 1)     ; enqueue is an independent transaction
+(defconstant +OCI-ENQ-ON-COMMIT+ 2)     ; enqueue is part of current transaction
 
 ; - Dequeue mode flags -
-(defconstant +OCI-DEQ-BROWSE+ 1)       ; read message without acquiring a lock
-(defconstant +OCI-DEQ-LOCKED+ 2)       ; read and obtain write lock on message
-(defconstant +OCI-DEQ-REMOVE+ 3)       ; read the message and delete it
+(defconstant +OCI-DEQ-BROWSE+ 1)        ; read message without acquiring a lock
+(defconstant +OCI-DEQ-LOCKED+ 2)        ; read and obtain write lock on message
+(defconstant +OCI-DEQ-REMOVE+ 3)        ; read the message and delete it
 
 ; - Dequeue navigation flags -
 (defconstant +OCI-DEQ-FIRST-MSG+ 1)     ; get first message at head of queue
-(defconstant +OCI-DEQ-NEXT-MSG+ 3)     ; next message that is available
+(defconstant +OCI-DEQ-NEXT-MSG+ 3)      ; next message that is available
 (defconstant +OCI-DEQ-NEXT-TRANSACTION+ 2) ; get first message of next txn group
 
 ; - Message states -
-(defconstant +OCI-MSG-WAITING+ 1)      ; the message delay has not yet completed
-(defconstant +OCI-MSG-READY+ 0)                ; the message is ready to be processed
-(defconstant +OCI-MSG-PROCESSED+ 2)    ; the message has been processed
-(defconstant +OCI-MSG-EXPIRED+ 3)      ; message has moved to exception queue
+(defconstant +OCI-MSG-WAITING+ 1)       ; the message delay has not yet completed
+(defconstant +OCI-MSG-READY+ 0)         ; the message is ready to be processed
+(defconstant +OCI-MSG-PROCESSED+ 2)     ; the message has been processed
+(defconstant +OCI-MSG-EXPIRED+ 3)       ; message has moved to exception queue
 
 ; - Sequence deviation -
-(defconstant +OCI-ENQ-BEFORE+ 2)       ; enqueue message before another message
-(defconstant +OCI-ENQ-TOP+ 3)          ; enqueue message before all messages
+(defconstant +OCI-ENQ-BEFORE+ 2)        ; enqueue message before another message
+(defconstant +OCI-ENQ-TOP+ 3)           ; enqueue message before all messages
 
 ; - Visibility flags -
-(defconstant +OCI-DEQ-IMMEDIATE+ 1)    ; dequeue is an independent transaction
-(defconstant +OCI-DEQ-ON-COMMIT+ 2)    ; dequeue is part of current transaction
+(defconstant +OCI-DEQ-IMMEDIATE+ 1)     ; dequeue is an independent transaction
+(defconstant +OCI-DEQ-ON-COMMIT+ 2)     ; dequeue is part of current transaction
 
 ; - Wait -
-(defconstant +OCI-DEQ-WAIT-FOREVER+ -1)        ; wait forever if no message available
-(defconstant +OCI-DEQ-NO-WAIT+ 0)      ; do not wait if no message is available
+(defconstant +OCI-DEQ-WAIT-FOREVER+ -1) ; wait forever if no message available
+(defconstant +OCI-DEQ-NO-WAIT+ 0)       ; do not wait if no message is available
 
 ; - Delay -
-(defconstant +OCI-MSG-NO-DELAY+ 0)     ; message is available immediately
+(defconstant +OCI-MSG-NO-DELAY+ 0)      ; message is available immediately
 
 ;; Expiration
 (defconstant +OCI-MSG-NO-EXPIRATION+ -1) ; message will never expire
 ;; Describe Handle Parameter Attributes
 ;; Attributes common to Columns and Stored Procs
 
-(defconstant +oci-attr-data-size+ 1)   ; maximum size of the data
-(defconstant +oci-attr-data-type+ 2)   ; the sql type of the column/argument
-(defconstant +oci-attr-disp-size+ 3)   ; the display size
+(defconstant +oci-attr-data-size+ 1)    ; maximum size of the data
+(defconstant +oci-attr-data-type+ 2)    ; the sql type of the column/argument
+(defconstant +oci-attr-disp-size+ 3)    ; the display size
 (defconstant +oci-attr-name+      4)    ; the name of the column/argument
-(defconstant +oci-attr-precision+ 5)   ; precision if number type
-(defconstant +oci-attr-scale+     6)   ; scale if number type
-(defconstant +oci-attr-is-null+   7)   ; is it null ?
+(defconstant +oci-attr-precision+ 5)    ; precision if number type
+(defconstant +oci-attr-scale+     6)    ; scale if number type
+(defconstant +oci-attr-is-null+   7)    ; is it null ?
 (defconstant +oci-attr-type-name+ 8)
 
 ;; name of the named data type or a package name for package private types
 
-(defconstant +OCI-ATTR-SCHEMA-NAME+ 9) ; the schema name
-(defconstant +OCI-ATTR-SUB-NAME+ 10)   ; type name if package private type
-(defconstant +OCI-ATTR-POSITION+ 11)   ; relative position of col/arg in the list of cols/args
+(defconstant +OCI-ATTR-SCHEMA-NAME+ 9)  ; the schema name
+(defconstant +OCI-ATTR-SUB-NAME+ 10)    ; type name if package private type
+(defconstant +OCI-ATTR-POSITION+ 11)    ; relative position of col/arg in the list of cols/args
 
 ; complex object retrieval parameter attributes
 (defconstant +OCI-ATTR-COMPLEXOBJECTCOMP-TYPE+ 50) ;
 (defconstant +OCI-ATTR-COMPLEXOBJECT-COLL-OUTOFLINE+ 53) ;
 
 ; Only Columns
-(defconstant +OCI-ATTR-DISP-NAME+ 100) ; the display name
+(defconstant +OCI-ATTR-DISP-NAME+ 100)  ; the display name
 
 ;; stored procs
 
-(defconstant +OCI-ATTR-OVERLOAD+ 210)  ; is this position overloaded
-(defconstant +OCI-ATTR-LEVEL+ 211)     ; level for structured types
+(defconstant +OCI-ATTR-OVERLOAD+ 210)   ; is this position overloaded
+(defconstant +OCI-ATTR-LEVEL+ 211)      ; level for structured types
 (defconstant +OCI-ATTR-HAS-DEFAULT+ 212) ; has a default value
-(defconstant +OCI-ATTR-IOMODE+ 213)    ; in, out inout
-(defconstant +OCI-ATTR-RADIX+ 214)     ; returns a radix
-(defconstant +OCI-ATTR-NUM-ARGS+ 215)  ; total number of arguments
+(defconstant +OCI-ATTR-IOMODE+ 213)     ; in, out inout
+(defconstant +OCI-ATTR-RADIX+ 214)      ; returns a radix
+(defconstant +OCI-ATTR-NUM-ARGS+ 215)   ; total number of arguments
 
 ;; named type attributes
 
 (defconstant +oci-attr-order-method+            233) ; order method of type
 
 ; only collection element
-(defconstant +OCI-ATTR-NUM-ELEMS+ 234) ; number of elements
+(defconstant +OCI-ATTR-NUM-ELEMS+ 234)  ; number of elements
 
 ; only type methods
 (defconstant +OCI-ATTR-ENCAPSULATION+ 235) ; encapsulation level
-(defconstant +OCI-ATTR-IS-SELFISH+ 236)        ; method selfish
-(defconstant +OCI-ATTR-IS-VIRTUAL+ 237)        ; virtual
-(defconstant +OCI-ATTR-IS-INLINE+ 238) ; inline
+(defconstant +OCI-ATTR-IS-SELFISH+ 236) ; method selfish
+(defconstant +OCI-ATTR-IS-VIRTUAL+ 237) ; virtual
+(defconstant +OCI-ATTR-IS-INLINE+ 238)  ; inline
 (defconstant +OCI-ATTR-IS-CONSTANT+ 239) ; constant
-(defconstant +OCI-ATTR-HAS-RESULT+ 240)        ; has result
+(defconstant +OCI-ATTR-HAS-RESULT+ 240) ; has result
 (defconstant +OCI-ATTR-IS-CONSTRUCTOR+ 241) ; constructor
 (defconstant +OCI-ATTR-IS-DESTRUCTOR+ 242) ; destructor
 (defconstant +OCI-ATTR-IS-OPERATOR+ 243) ; operator
-(defconstant +OCI-ATTR-IS-MAP+ 244)    ; a map method
-(defconstant +OCI-ATTR-IS-ORDER+ 245)  ; order method
-(defconstant +OCI-ATTR-IS-RNDS+ 246)   ; read no data state method
-(defconstant +OCI-ATTR-IS-RNPS+ 247)   ; read no process state
-(defconstant +OCI-ATTR-IS-WNDS+ 248)   ; write no data state method
-(defconstant +OCI-ATTR-IS-WNPS+ 249)   ; write no process state
+(defconstant +OCI-ATTR-IS-MAP+ 244)     ; a map method
+(defconstant +OCI-ATTR-IS-ORDER+ 245)   ; order method
+(defconstant +OCI-ATTR-IS-RNDS+ 246)    ; read no data state method
+(defconstant +OCI-ATTR-IS-RNPS+ 247)    ; read no process state
+(defconstant +OCI-ATTR-IS-WNDS+ 248)    ; write no data state method
+(defconstant +OCI-ATTR-IS-WNPS+ 249)    ; write no process state
 
 ; describing public objects
 (defconstant +OCI-ATTR-DESC-PUBLIC+ 250) ; public object
 ;-
 
 ;-OCIPasswordChange-
-(defconstant +OCI-AUTH+ #x08)          ; Change the password but do not login
+(defconstant +OCI-AUTH+ #x08)           ; Change the password but do not login
 
 
 ;-Other Constants-
-(defconstant +OCI-MAX-FNS+ 100)                ; max number of OCI Functions
-(defconstant +OCI-SQLSTATE-SIZE+ 5)    ;
+(defconstant +OCI-MAX-FNS+ 100)         ; max number of OCI Functions
+(defconstant +OCI-SQLSTATE-SIZE+ 5)     ;
 (defconstant +OCI-ERROR-MAXMSG-SIZE+ 1024) ; max size of an error message
-;; (defconstant +OCI-LOBMAXSIZE+ 4MAXVAL)      ; maximum lob data size
-(defconstant +OCI-ROWID-LEN+ 23)       ;
+;; (defconstant +OCI-LOBMAXSIZE+ 4MAXVAL)       ; maximum lob data size
+(defconstant +OCI-ROWID-LEN+ 23)        ;
 ;-
 
 ;- Fail Over Events -
-(defconstant +OCI-FO-END+ #x00000001)  ;
-(defconstant +OCI-FO-ABORT+ #x00000002)        ; 
+(defconstant +OCI-FO-END+ #x00000001)   ;
+(defconstant +OCI-FO-ABORT+ #x00000002) ;
 (defconstant +OCI-FO-REAUTH+ #x00000004) ;
-(defconstant +OCI-FO-BEGIN+ #x00000008)        ;
+(defconstant +OCI-FO-BEGIN+ #x00000008) ;
 (defconstant +OCI-FO-ERROR+ #x00000010) ;
 ;-
 
 ;- Fail Over Types -
-(defconstant +OCI-FO-NONE+ #x00000001) ;
+(defconstant +OCI-FO-NONE+ #x00000001)  ;
 (defconstant +OCI-FO-SESSION+ #x00000002) ;
 (defconstant +OCI-FO-SELECT+ #x00000004) ;
 (defconstant +OCI-FO-TXNAL+ #x00000008) ;
 ;-
 
 ;-Function Codes-
-(defconstant +OCI-FNCODE-INITIALIZE+ 1)        ; OCIInitialize
+(defconstant +OCI-FNCODE-INITIALIZE+ 1) ; OCIInitialize
 (defconstant +OCI-FNCODE-HANDLEALLOC+ 2) ; OCIHandleAlloc
-(defconstant +OCI-FNCODE-HANDLEFREE+ 3)        ; OCIHandleFree
+(defconstant +OCI-FNCODE-HANDLEFREE+ 3) ; OCIHandleFree
 (defconstant +OCI-FNCODE-DESCRIPTORALLOC+ 4) ; OCIDescriptorAlloc
 (defconstant +OCI-FNCODE-DESCRIPTORFREE+ 5) ; OCIDescriptorFree
-(defconstant +OCI-FNCODE-ENVINIT+ 6)   ; OCIEnvInit
+(defconstant +OCI-FNCODE-ENVINIT+ 6)    ; OCIEnvInit
 (defconstant +OCI-FNCODE-SERVERATTACH+ 7) ; OCIServerAttach
 (defconstant +OCI-FNCODE-SERVERDETACH+ 8) ; OCIServerDetach
-; unused         9 
+; unused         9
 (defconstant +OCI-FNCODE-SESSIONBEGIN+ 10) ; OCISessionBegin
 (defconstant +OCI-FNCODE-SESSIONEND+ 11) ; OCISessionEnd
 (defconstant +OCI-FNCODE-PASSWORDCHANGE+ 12) ; OCIPasswordChange
 (defconstant +OCI-FNCODE-BINDDYNAMIC+ 17) ; OCIBindDynamic
 (defconstant +OCI-FNCODE-BINDOBJECT+ 18) ; OCIBindObject
                                                                 ; 19 unused
-(defconstant +OCI-FNCODE-BINDARRAYOFSTRUCT+ 20)        ; OCIBindArrayOfStruct
+(defconstant +OCI-FNCODE-BINDARRAYOFSTRUCT+ 20) ; OCIBindArrayOfStruct
 (defconstant +OCI-FNCODE-STMTEXECUTE+ 21) ; OCIStmtExecute
                                                              ; unused 22-24
 (defconstant +OCI-FNCODE-DEFINEOBJECT+ 25) ; OCIDefineObject
 (defconstant +OCI-FNCODE-DEFINEDYNAMIC+ 26) ; OCIDefineDynamic
 (defconstant +OCI-FNCODE-DEFINEARRAYOFSTRUCT+ 27) ; OCIDefineArrayOfStruct
-(defconstant +OCI-FNCODE-STMTFETCH+ 28)        ; OCIStmtFetch
+(defconstant +OCI-FNCODE-STMTFETCH+ 28) ; OCIStmtFetch
 (defconstant +OCI-FNCODE-STMTGETBIND+ 29) ; OCIStmtGetBindInfo
                                                             ; 30, 31 unused
 (defconstant +OCI-FNCODE-DESCRIBEANY+ 32) ; OCIDescribeAny
 (defconstant +OCI-FNCODE-TRANSDETACH+ 34) ; OCITransDetach
 (defconstant +OCI-FNCODE-TRANSCOMMIT+ 35) ; OCITransCommit
                                                                 ; 36 unused
-(defconstant +OCI-FNCODE-ERRORGET+ 37) ; OCIErrorGet
+(defconstant +OCI-FNCODE-ERRORGET+ 37)  ; OCIErrorGet
 (defconstant +OCI-FNCODE-LOBOPENFILE+ 38) ; OCILobFileOpen
 (defconstant +OCI-FNCODE-LOBCLOSEFILE+ 39) ; OCILobFileClose
                                              ; 40 was LOBCREATEFILE, unused
                                          ; 41 was OCILobFileDelete, unused
-(defconstant +OCI-FNCODE-LOBCOPY+ 42)  ; OCILobCopy
-(defconstant +OCI-FNCODE-LOBAPPEND+ 43)        ; OCILobAppend
-(defconstant +OCI-FNCODE-LOBERASE+ 44) ; OCILobErase
-(defconstant +OCI-FNCODE-LOBLENGTH+ 45)        ; OCILobGetLength
-(defconstant +OCI-FNCODE-LOBTRIM+ 46)  ; OCILobTrim
-(defconstant +OCI-FNCODE-LOBREAD+ 47)  ; OCILobRead
-(defconstant +OCI-FNCODE-LOBWRITE+ 48) ; OCILobWrite
+(defconstant +OCI-FNCODE-LOBCOPY+ 42)   ; OCILobCopy
+(defconstant +OCI-FNCODE-LOBAPPEND+ 43) ; OCILobAppend
+(defconstant +OCI-FNCODE-LOBERASE+ 44)  ; OCILobErase
+(defconstant +OCI-FNCODE-LOBLENGTH+ 45) ; OCILobGetLength
+(defconstant +OCI-FNCODE-LOBTRIM+ 46)   ; OCILobTrim
+(defconstant +OCI-FNCODE-LOBREAD+ 47)   ; OCILobRead
+(defconstant +OCI-FNCODE-LOBWRITE+ 48)  ; OCILobWrite
                                                                 ; 49 unused
 (defconstant +OCI-FNCODE-SVCCTXBREAK+ 50) ; OCIBreak
 (defconstant +OCI-FNCODE-SERVERVERSION+ 51) ; OCIServerVersion
 ; unused 52, 53
-(defconstant +OCI-FNCODE-ATTRGET+ 54)  ; OCIAttrGet
-(defconstant +OCI-FNCODE-ATTRSET+ 55)  ; OCIAttrSet
-(defconstant +OCI-FNCODE-PARAMSET+ 56) ; OCIParamSet
-(defconstant +OCI-FNCODE-PARAMGET+ 57) ; OCIParamGet
+(defconstant +OCI-FNCODE-ATTRGET+ 54)   ; OCIAttrGet
+(defconstant +OCI-FNCODE-ATTRSET+ 55)   ; OCIAttrSet
+(defconstant +OCI-FNCODE-PARAMSET+ 56)  ; OCIParamSet
+(defconstant +OCI-FNCODE-PARAMGET+ 57)  ; OCIParamGet
 (defconstant +OCI-FNCODE-STMTGETPIECEINFO+ 58) ; OCIStmtGetPieceInfo
 (defconstant +OCI-FNCODE-LDATOSVCCTX+ 59) ; OCILdaToSvcCtx
                                                                 ; 60 unused
 (defconstant +OCI-FNCODE-TRANSPREPARE+ 63) ; OCITransPrepare
 (defconstant +OCI-FNCODE-TRANSROLLBACK+ 64) ; OCITransRollback
 (defconstant +OCI-FNCODE-DEFINEBYPOS+ 65) ; OCIDefineByPos
-(defconstant +OCI-FNCODE-BINDBYPOS+ 66)        ; OCIBindByPos
+(defconstant +OCI-FNCODE-BINDBYPOS+ 66) ; OCIBindByPos
 (defconstant +OCI-FNCODE-BINDBYNAME+ 67) ; OCIBindByName
-(defconstant +OCI-FNCODE-LOBASSIGN+ 68)        ; OCILobAssign
+(defconstant +OCI-FNCODE-LOBASSIGN+ 68) ; OCILobAssign
 (defconstant +OCI-FNCODE-LOBISEQUAL+ 69) ; OCILobIsEqual
-(defconstant +OCI-FNCODE-LOBISINIT+ 70)        ; OCILobLocatorIsInit
+(defconstant +OCI-FNCODE-LOBISINIT+ 70) ; OCILobLocatorIsInit
 ; 71 was lob locator size in beta2
 (defconstant +OCI-FNCODE-LOBENABLEBUFFERING+ 71) ; OCILobEnableBuffering
 (defconstant +OCI-FNCODE-LOBCHARSETID+ 72) ; OCILobCharSetID
 (defconstant +OCI-FNCODE-LOBCHARSETFORM+ 73) ; OCILobCharSetForm
 (defconstant +OCI-FNCODE-LOBFILESETNAME+ 74) ; OCILobFileSetName
 (defconstant +OCI-FNCODE-LOBFILEGETNAME+ 75) ; OCILobFileGetName
-(defconstant +OCI-FNCODE-LOGON+ 76)    ; OCILogon
-(defconstant +OCI-FNCODE-LOGOFF+ 77)   ; OCILogoff
+(defconstant +OCI-FNCODE-LOGON+ 76)     ; OCILogon
+(defconstant +OCI-FNCODE-LOGOFF+ 77)    ; OCILogoff
 (defconstant +OCI-FNCODE-LOBDISABLEBUFFERING+ 78) ; OCILobDisableBuffering
 (defconstant +OCI-FNCODE-LOBFLUSHBUFFER+ 79) ; OCILobFlushBuffer
 (defconstant +OCI-FNCODE-LOBLOADFROMFILE+ 80) ; OCILobLoadFromFile
 ;-
 
 ;- FILE open modes -
-(defconstant +OCI-FILE-READONLY+ 1)    ; readonly mode open for FILE types
+(defconstant +OCI-FILE-READONLY+ 1)     ; readonly mode open for FILE types
 ;-
 
 ;- LOB Buffering Flush Flags -
-(defconstant +OCI-LOB-BUFFER-FREE+ 1)  ;
+(defconstant +OCI-LOB-BUFFER-FREE+ 1)   ;
 (defconstant +OCI-LOB-BUFFER-NOFREE+ 2) ;
 ;-
 
 ;- OCI Statement Types -
 
-(defconstant +oci-stmt-select+ 1)      ; select statement
-(defconstant +oci-stmt-update+ 2)      ; update statement
-(defconstant +oci-stmt-delete+ 3)      ; delete statement
-(defconstant +oci-stmt-insert+ 4)      ; insert statement
-(defconstant +oci-stmt-create+ 5)      ; create statement
-(defconstant +oci-stmt-drop+ 6)                ; drop statement
-(defconstant +oci-stmt-alter+ 7)       ; alter statement
-(defconstant +oci-stmt-begin+ 8)       ; begin ... (pl/sql statement)
-(defconstant +oci-stmt-declare+ 9)     ; declare .. (pl/sql statement )
+(defconstant +oci-stmt-select+ 1)       ; select statement
+(defconstant +oci-stmt-update+ 2)       ; update statement
+(defconstant +oci-stmt-delete+ 3)       ; delete statement
+(defconstant +oci-stmt-insert+ 4)       ; insert statement
+(defconstant +oci-stmt-create+ 5)       ; create statement
+(defconstant +oci-stmt-drop+ 6)         ; drop statement
+(defconstant +oci-stmt-alter+ 7)        ; alter statement
+(defconstant +oci-stmt-begin+ 8)        ; begin ... (pl/sql statement)
+(defconstant +oci-stmt-declare+ 9)      ; declare .. (pl/sql statement )
 ;-
 
 ;- OCI Parameter Types -
-(defconstant +OCI-PTYPE-UNK+ 0)                ; unknown
-(defconstant +OCI-PTYPE-TABLE+ 1)      ; table
-(defconstant +OCI-PTYPE-VIEW+ 2)       ; view
-(defconstant +OCI-PTYPE-PROC+ 3)       ; procedure
-(defconstant +OCI-PTYPE-FUNC+ 4)       ; function
-(defconstant +OCI-PTYPE-PKG+ 5)                ; package
-(defconstant +OCI-PTYPE-TYPE+ 6)       ; user-defined type
-(defconstant +OCI-PTYPE-SYN+ 7)                ; synonym
-(defconstant +OCI-PTYPE-SEQ+ 8)                ; sequence
-(defconstant +OCI-PTYPE-COL+ 9)                ; column
-(defconstant +OCI-PTYPE-ARG+ 10)       ; argument
-(defconstant +OCI-PTYPE-LIST+ 11)      ; list
-(defconstant +OCI-PTYPE-TYPE-ATTR+ 12) ; user-defined type's attribute
-(defconstant +OCI-PTYPE-TYPE-COLL+ 13) ; collection type's element
+(defconstant +OCI-PTYPE-UNK+ 0)         ; unknown
+(defconstant +OCI-PTYPE-TABLE+ 1)       ; table
+(defconstant +OCI-PTYPE-VIEW+ 2)        ; view
+(defconstant +OCI-PTYPE-PROC+ 3)        ; procedure
+(defconstant +OCI-PTYPE-FUNC+ 4)        ; function
+(defconstant +OCI-PTYPE-PKG+ 5)         ; package
+(defconstant +OCI-PTYPE-TYPE+ 6)        ; user-defined type
+(defconstant +OCI-PTYPE-SYN+ 7)         ; synonym
+(defconstant +OCI-PTYPE-SEQ+ 8)         ; sequence
+(defconstant +OCI-PTYPE-COL+ 9)         ; column
+(defconstant +OCI-PTYPE-ARG+ 10)        ; argument
+(defconstant +OCI-PTYPE-LIST+ 11)       ; list
+(defconstant +OCI-PTYPE-TYPE-ATTR+ 12)  ; user-defined type's attribute
+(defconstant +OCI-PTYPE-TYPE-COLL+ 13)  ; collection type's element
 (defconstant +OCI-PTYPE-TYPE-METHOD+ 14) ; user-defined type's method
-(defconstant +OCI-PTYPE-TYPE-ARG+ 15)  ; user-defined type method's argument
+(defconstant +OCI-PTYPE-TYPE-ARG+ 15)   ; user-defined type method's argument
 (defconstant +OCI-PTYPE-TYPE-RESULT+ 16) ; user-defined type method's result
 ;-
 
 ;- OCI List Types -
-(defconstant +OCI-LTYPE-UNK+ 0)                ; unknown
-(defconstant +OCI-LTYPE-COLUMN+ 1)     ; column list
-(defconstant +OCI-LTYPE-ARG-PROC+ 2)   ; procedure argument list
-(defconstant +OCI-LTYPE-ARG-FUNC+ 3)   ; function argument list
-(defconstant +OCI-LTYPE-SUBPRG+ 4)     ; subprogram list
-(defconstant +OCI-LTYPE-TYPE-ATTR+ 5)  ; type attribute
-(defconstant +OCI-LTYPE-TYPE-METHOD+ 6)        ; type method
+(defconstant +OCI-LTYPE-UNK+ 0)         ; unknown
+(defconstant +OCI-LTYPE-COLUMN+ 1)      ; column list
+(defconstant +OCI-LTYPE-ARG-PROC+ 2)    ; procedure argument list
+(defconstant +OCI-LTYPE-ARG-FUNC+ 3)    ; function argument list
+(defconstant +OCI-LTYPE-SUBPRG+ 4)      ; subprogram list
+(defconstant +OCI-LTYPE-TYPE-ATTR+ 5)   ; type attribute
+(defconstant +OCI-LTYPE-TYPE-METHOD+ 6) ; type method
 (defconstant +OCI-LTYPE-TYPE-ARG-PROC+ 7) ; type method w/o result argument list
 (defconstant +OCI-LTYPE-TYPE-ARG-FUNC+ 8) ; type method w/result argument list
 
index ea9c15b..5c7d7fb 100644 (file)
   (declare (ignore type args database))
     (format nil "VARCHAR2(~D)" *default-string-length*))
 
-(defmethod database-get-type-specifier ((type (eql 'integer)) args 
-                                       database (db-type (eql :oracle)))
+(defmethod database-get-type-specifier ((type (eql 'integer)) args
+                                        database (db-type (eql :oracle)))
   (declare (ignore database))
   (if args
       (format nil "NUMBER(~A,~A)"
-             (or (first args) 38) (or (second args) 0))
+              (or (first args) 38) (or (second args) 0))
     "INTEGER"))
 
 (defmethod database-get-type-specifier ((type (eql 'bigint)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore args database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore args database))
   "CHAR(20)")
 
 (defmethod database-get-type-specifier ((type (eql 'universal-time)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore args database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore args database))
   "CHAR(20)")
 
 (defmethod database-get-type-specifier ((type (eql 'string)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore database))
   (if args
       (format nil "CHAR(~A)" (car args))
     (format nil "VARCHAR2(~D)" *default-string-length*)))
 
 (defmethod database-get-type-specifier ((type (eql 'varchar)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore database))
   (if args
       (format nil "VARCHAR2(~A)" (car args))
     (format nil "VARCHAR2(~D)" *default-string-length*)))
 
 (defmethod database-get-type-specifier ((type (eql 'float)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore database))
   (if args
       (format nil "NUMBER(~A,~A)" (or (first args) 38) (or (second args) 38))
     "DOUBLE PRECISION"))
 
 (defmethod database-get-type-specifier ((type (eql 'long-float)) args
-                                       database (db-type (eql :oracle)))
-  (declare (ignore database)) 
+                                        database (db-type (eql :oracle)))
+  (declare (ignore database))
   (if args
       (format nil "NUMBER(~A,~A)"
-             (or (first args) 38) (or (second args) 38))
+              (or (first args) 38) (or (second args) 38))
     "DOUBLE PRECISION"))
 
 (defmethod database-get-type-specifier ((type (eql 'boolean)) args
-                                       database (db-type (eql :oracle)))
+                                        database (db-type (eql :oracle)))
   (declare (ignore args database))
   "CHAR(1)")
 
 (defmethod database-get-type-specifier ((type (eql 'generalized-boolean)) args
-                                       database (db-type (eql :oracle)))
+                                        database (db-type (eql :oracle)))
   (declare (ignore args database))
   "CHAR(1)")
 
 (defmethod read-sql-value (val type
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   ;;(format t "value is \"~A\" of type ~A~%" val (type-of val))
   (declare (ignore type database))
   (etypecase val
      nil)))
 
 (defmethod read-sql-value (val (type (eql 'integer))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   val)
 
 (defmethod read-sql-value (val (type (eql 'float))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   val)
 
 (defmethod read-sql-value (val (type (eql 'boolean))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   (when (char-equal #\t (schar val 0))
     t))
 
 (defmethod read-sql-value (val (type (eql 'generalized-boolean))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   (when (char-equal #\t (schar val 0))
     t))
 
 (defmethod read-sql-value (val (type (eql 'bigint))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   (parse-integer val))
 
 (defmethod read-sql-value (val (type (eql 'universal-time))
-                          database (db-type (eql :oracle)))
+                           database (db-type (eql :oracle)))
   (declare (ignore database))
   (parse-integer val))
 
 
 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args
-                                       database (db-type (eql :oracle)))
+                                        database (db-type (eql :oracle)))
   (declare (ignore args database))
   "DATE")
 
 (defmethod database-get-type-specifier ((type (eql 'duration)) args
-                                       database (db-type (eql :oracle)))
+                                        database (db-type (eql :oracle)))
   (declare (ignore args database))
   "NUMBER(38)")
index 07f0a55..462c858 100644 (file)
@@ -19,7 +19,7 @@
 (defpackage #:clsql-oracle
   (:use #:common-lisp #:clsql-sys #:clsql-uffi)
   (:export #:oracle-database
-          #:*oracle-server-version*
-          #:*oracle-so-load-path*
-          #:*oracle-so-libraries*)
+           #:*oracle-server-version*
+           #:*oracle-so-load-path*
+           #:*oracle-so-libraries*)
   (:documentation "This is the CLSQL interface to Oracle."))
index 3f5cb49..87d1137 100644 (file)
@@ -143,8 +143,8 @@ the length of that format.")
      (error 'sql-database-error :message "Check ORACLE_HOME and NLS settings."))
     (t
      (error 'sql-database-error
-           :message
-           (format nil "OCI unknown error, code=~A" result)))))
+            :message
+            (format nil "OCI unknown error, code=~A" result)))))
 
 ;;; Handle the messy case of return code=+oci-error+, querying the
 ;;; system for subcodes and reporting them as appropriate. ERRHP and
@@ -156,34 +156,34 @@ the length of that format.")
      (with-slots (errhp) database
        (let ((errcode (uffi:allocate-foreign-object 'sb4))
              (errbuf (uffi:allocate-foreign-string #.+errbuf-len+)))
-        ;; ensure errbuf empty string
-        (setf (uffi:deref-array errbuf '(:array :unsigned-char) 0)
-              (uffi:ensure-char-storable (code-char 0)))
-        (setf (uffi:deref-pointer errcode 'sb4) 0)
-
-        (uffi:with-cstring (sqlstate nil)
-          (oci-error-get (deref-vp errhp) 1
-                         sqlstate
-                         errcode
-                         (uffi:char-array-to-pointer errbuf)
-                         +errbuf-len+ +oci-htype-error+))
-        (let ((subcode (uffi:deref-pointer errcode 'sb4))
-              (errstr (uffi:convert-from-foreign-string errbuf)))
+         ;; ensure errbuf empty string
+         (setf (uffi:deref-array errbuf '(:array :unsigned-char) 0)
+               (uffi:ensure-char-storable (code-char 0)))
+         (setf (uffi:deref-pointer errcode 'sb4) 0)
+
+         (uffi:with-cstring (sqlstate nil)
+           (oci-error-get (deref-vp errhp) 1
+                          sqlstate
+                          errcode
+                          (uffi:char-array-to-pointer errbuf)
+                          +errbuf-len+ +oci-htype-error+))
+         (let ((subcode (uffi:deref-pointer errcode 'sb4))
+               (errstr (uffi:convert-from-foreign-string errbuf)))
            (uffi:free-foreign-object errcode)
            (uffi:free-foreign-object errbuf)
-          (unless (and nulls-ok (= subcode +null-value-returned+))
-            (error 'sql-database-error
-                   :database database
-                   :error-id subcode
-                   :message errstr))))))
+           (unless (and nulls-ok (= subcode +null-value-returned+))
+             (error 'sql-database-error
+                    :database database
+                    :error-id subcode
+                    :message errstr))))))
     (nulls-ok
      (error 'sql-database-error
-           :database database
-           :message "can't handle NULLS-OK without ERRHP"))
+            :database database
+            :message "can't handle NULLS-OK without ERRHP"))
     (t
      (error 'sql-database-error
-           :database database
-           :message "OCI Error (and no ERRHP available to find subcode)"))))
+            :database database
+            :message "OCI Error (and no ERRHP available to find subcode)"))))
 
 ;;; Require an OCI success code.
 ;;;
@@ -199,7 +199,7 @@ the length of that format.")
   (declare (type fixnum code))
   (unless (= code +oci-success+)
     (error 'sql-database-error
-          :message (format nil "unexpected OCI failure, code=~S" code))))
+           :message (format nil "unexpected OCI failure, code=~S" code))))
 
 
 ;;; Enabling this can be handy for low-level debugging.
@@ -222,9 +222,9 @@ the length of that format.")
   (declare (type (mod #.+n-buf-rows+) string-index))
   (declare (type (and unsigned-byte fixnum) size))
   (let ((str (uffi:convert-from-foreign-string
-             (uffi:make-pointer
-              (+ (uffi:pointer-address arrayptr) (* string-index size))
-              :unsigned-char))))
+              (uffi:make-pointer
+               (+ (uffi:pointer-address arrayptr) (* string-index size))
+               :unsigned-char))))
     (if (string-equal str "NULL") nil str)))
 
 ;; the OCI library, part Z: no-longer used logic to convert from
@@ -240,42 +240,42 @@ the length of that format.")
 #+nil
 (defun deref-oci-date (arrayptr index)
   (oci-date->universal-time (uffi:pointer-address
-                            (uffi:deref-array arrayptr
-                                              '(:array :unsigned-char)
-                                              (* index +oci-date-bytes+)))))
+                             (uffi:deref-array arrayptr
+                                               '(:array :unsigned-char)
+                                               (* index +oci-date-bytes+)))))
 #+nil
 (defun oci-date->universal-time (oci-date)
   (declare (type (alien (* :unsigned-char)) oci-date))
   (flet (;; a character from OCI-DATE, interpreted as an unsigned byte
-        (ub (i)
-          (declare (type (mod #.+oci-date-bytes+) i))
-          (mod (uffi:deref-array oci-date string-array i) 256)))
+         (ub (i)
+           (declare (type (mod #.+oci-date-bytes+) i))
+           (mod (uffi:deref-array oci-date string-array i) 256)))
     (let* ((century (* (- (ub 0) 100) 100))
-          (year    (+ century (- (ub 1) 100)))
-          (month   (ub 2))
-          (day     (ub 3))
-          (hour    (1- (ub 4)))
-          (minute  (1- (ub 5)))
-          (second  (1- (ub 6))))
+           (year    (+ century (- (ub 1) 100)))
+           (month   (ub 2))
+           (day     (ub 3))
+           (hour    (1- (ub 4)))
+           (minute  (1- (ub 5)))
+           (second  (1- (ub 6))))
       (encode-universal-time second minute hour day month year))))
 
 
 (defmethod database-list-tables ((database oracle-database) &key owner)
   (let ((query
-         (cond ((null owner)
+          (cond ((null owner)
                  "select table_name from user_tables")
                 ((eq owner :all)
                  "select table_name from all_tables")
                 (t
                  (format nil
                          "select user_tables.table_name from user_tables,all_tables where user_tables.table_name=all_tables.table_name and all_tables.owner='~:@(~A~)'"
-                     owner)))))
+                      owner)))))
     (mapcar #'car (database-query query database nil nil))))
 
 
 (defmethod database-list-views ((database oracle-database) &key owner)
   (let ((query
-         (cond ((null owner)
+          (cond ((null owner)
                  "select view_name from user_views")
                 ((eq owner :all)
                  "select view_name from all_views")
@@ -299,7 +299,7 @@ the length of that format.")
     (mapcar #'car (database-query query database nil nil))))
 
 (defmethod database-list-table-indexes (table (database oracle-database)
-                                       &key (owner nil))
+                                        &key (owner nil))
   (let ((query
          (cond ((null owner)
                 (format nil "select index_name from user_indexes where table_name='~A'"
@@ -329,10 +329,10 @@ the length of that format.")
     (mapcar #'car (database-query query database nil nil))))
 
 (defmethod database-attribute-type (attribute (table string)
-                                        (database oracle-database)
-                                        &key (owner nil))
+                                         (database oracle-database)
+                                         &key (owner nil))
   (let ((query
-        (cond ((null owner)
+         (cond ((null owner)
                 (format nil
                         "select data_type,data_length,data_scale,nullable from user_tab_columns where table_name='~A' and column_name='~A'"
                         table attribute))
@@ -346,7 +346,7 @@ the length of that format.")
                         table attribute owner)))))
     (destructuring-bind (type length scale nullable) (car (database-query query database :auto nil))
       (values (ensure-keyword type) length scale
-             (if (char-equal #\Y (schar nullable 0)) 1 0)))))
+              (if (char-equal #\Y (schar nullable 0)) 1 0)))))
 
 ;; Return one row of the table referred to by QC, represented as a
 ;; list; or if there are no more rows, signal an error if EOF-ERRORP,
@@ -380,11 +380,11 @@ the length of that format.")
     :type oracle-database
     :read-only t)
   (stmthp (error "missing STMTHP")      ; the statement handle used to create
-;;  :type alien                        ; this table. owned by the QUERY-CURSOR
+;;  :type alien                 ; this table. owned by the QUERY-CURSOR
     :read-only t)                       ; object, deallocated on CLOSE-QUERY
   (cds) ;  (error "missing CDS")            ; column descriptors
 ;    :type (simple-array cd 1)
-                                       ;    :read-only t)
+                                        ;    :read-only t)
   (n-from-oci
    0                         ; buffered rows: number of rows recv'd
    :type (integer 0 #.+n-buf-rows+))   ; from the database on the last read
@@ -407,48 +407,48 @@ the length of that format.")
 (defun fetch-row (qc &optional (eof-errorp t) eof-value)
   (declare (optimize (speed 3)))
   (cond ((zerop (qc-n-from-oci qc))
-        (if eof-errorp
-            (error 'sql-database-error :message
-                   (format nil "no more rows available in ~S" qc))
-          eof-value))
-       ((>= (qc-n-to-dbi qc)
-            (qc-n-from-oci qc))
-        (refill-qc-buffers qc)
-        (fetch-row qc nil eof-value))
-       (t
-        (let ((cds (qc-cds qc))
-              (reversed-result nil)
-              (irow (qc-n-to-dbi qc)))
-          (dotimes (icd (length cds))
-            (let* ((cd (aref cds icd))
-                   (b (foreign-resource-buffer (cd-buffer cd)))
-                   (value
-                    (let* ((arb (foreign-resource-buffer (cd-indicators cd)))
-                           (indicator (uffi:deref-array arb '(:array :short) irow)))
-                      (declare (type short-array arb))
-                      (unless (= indicator -1)
-                        (ecase (cd-oci-data-type cd)
-                          (#.SQLT-STR
-                           (deref-oci-string b irow (cd-sizeof cd)))
-                          (#.SQLT-FLT
+         (if eof-errorp
+             (error 'sql-database-error :message
+                    (format nil "no more rows available in ~S" qc))
+           eof-value))
+        ((>= (qc-n-to-dbi qc)
+             (qc-n-from-oci qc))
+         (refill-qc-buffers qc)
+         (fetch-row qc nil eof-value))
+        (t
+         (let ((cds (qc-cds qc))
+               (reversed-result nil)
+               (irow (qc-n-to-dbi qc)))
+           (dotimes (icd (length cds))
+             (let* ((cd (aref cds icd))
+                    (b (foreign-resource-buffer (cd-buffer cd)))
+                    (value
+                     (let* ((arb (foreign-resource-buffer (cd-indicators cd)))
+                            (indicator (uffi:deref-array arb '(:array :short) irow)))
+                       (declare (type short-array arb))
+                       (unless (= indicator -1)
+                         (ecase (cd-oci-data-type cd)
+                           (#.SQLT-STR
+                            (deref-oci-string b irow (cd-sizeof cd)))
+                           (#.SQLT-FLT
                             (locally
                                 (declare (type double-array b))
                               (uffi:deref-array b '(:array :double) irow)))
-                          (#.SQLT-INT
-                           (ecase (cd-sizeof cd)
-                             (4
+                           (#.SQLT-INT
+                            (ecase (cd-sizeof cd)
+                              (4
                                (locally
                                    (declare (type int-array b))
                                  (uffi:deref-array b '(:array :int) irow)))))
-                          (#.SQLT-DATE
-                           (deref-oci-string b irow (cd-sizeof cd))))))))
-              (when (and (eq :string (cd-result-type cd))
-                         value
-                         (not (stringp value)))
-                  (setq value (write-to-string value)))
-              (push value reversed-result)))
-          (incf (qc-n-to-dbi qc))
-          (nreverse reversed-result)))))
+                           (#.SQLT-DATE
+                            (deref-oci-string b irow (cd-sizeof cd))))))))
+               (when (and (eq :string (cd-result-type cd))
+                          value
+                          (not (stringp value)))
+                   (setq value (write-to-string value)))
+               (push value reversed-result)))
+           (incf (qc-n-to-dbi qc))
+           (nreverse reversed-result)))))
 
 (defun refill-qc-buffers (qc)
   (with-slots (errhp) (qc-db qc)
@@ -457,10 +457,10 @@ the length of that format.")
            (setf (qc-n-from-oci qc) 0))
           (t
            (let ((oci-code (%oci-stmt-fetch
-                           (deref-vp (qc-stmthp qc))
-                           (deref-vp errhp)
-                           +n-buf-rows+
-                           +oci-fetch-next+ +oci-default+)))
+                            (deref-vp (qc-stmthp qc))
+                            (deref-vp errhp)
+                            +n-buf-rows+
+                            +oci-fetch-next+ +oci-default+)))
              (ecase oci-code
                (#.+oci-success+ (values))
                (#.+oci-no-data+ (setf (qc-oci-end-seen-p qc) t)
@@ -469,14 +469,14 @@ the length of that format.")
                                                 :nulls-ok t))))
            (uffi:with-foreign-object (rowcount 'ub4)
              (oci-attr-get (deref-vp (qc-stmthp qc))
-                          +oci-htype-stmt+
+                           +oci-htype-stmt+
                            rowcount
-                          +unsigned-int-null-pointer+
-                          +oci-attr-row-count+
+                           +unsigned-int-null-pointer+
+                           +oci-attr-row-count+
                            (deref-vp errhp))
              (setf (qc-n-from-oci qc)
                    (- (uffi:deref-pointer rowcount 'ub4)
-                     (qc-total-n-from-oci qc)))
+                      (qc-total-n-from-oci qc)))
              (when (< (qc-n-from-oci qc) +n-buf-rows+)
                (setf (qc-oci-end-seen-p qc) t))
              (setf (qc-total-n-from-oci qc)
@@ -550,10 +550,10 @@ the length of that format.")
 
 (defun make-query-cursor (db stmthp result-types field-names)
   (let ((qc (%make-query-cursor :db db
-                               :stmthp stmthp
-                               :cds (make-query-cursor-cds db stmthp
-                                                           result-types
-                                                           field-names))))
+                                :stmthp stmthp
+                                :cds (make-query-cursor-cds db stmthp
+                                                            result-types
+                                                            field-names))))
     (refill-qc-buffers qc)
     qc))
 
@@ -633,122 +633,122 @@ the length of that format.")
 
 (defun make-query-cursor-cds (database stmthp result-types field-names)
   (declare (optimize (safety 3) #+nil (speed 3))
-          (type oracle-database database)
-          (type pointer-pointer-void stmthp))
+           (type oracle-database database)
+           (type pointer-pointer-void stmthp))
   (with-slots (errhp) database
     (uffi:with-foreign-objects ((dtype-foreign :unsigned-short)
-                               (parmdp :pointer-void)
-                               (precision :short)
-                               (scale :byte)
-                               (colname '(* :unsigned-char))
-                               (colnamelen 'ub4)
-                               (colsize 'ub2)
-                               (defnp ':pointer-void))
+                                (parmdp :pointer-void)
+                                (precision :short)
+                                (scale :byte)
+                                (colname '(* :unsigned-char))
+                                (colnamelen 'ub4)
+                                (colsize 'ub2)
+                                (defnp ':pointer-void))
       (let ((buffer nil)
-           (sizeof nil))
-       (do ((icolumn 0 (1+ icolumn))
-            (cds-as-reversed-list nil))
-           ((not (eql (oci-param-get (deref-vp stmthp)
-                                     +oci-htype-stmt+
-                                     (deref-vp errhp)
-                                     parmdp
-                                     (1+ icolumn) :database database)
-                      +oci-success+))
-            (coerce (reverse cds-as-reversed-list) 'simple-vector))
-         ;; Decode type of ICOLUMNth column into a type we're prepared to
-         ;; handle in Lisp.
-         (oci-attr-get (deref-vp parmdp)
-                       +oci-dtype-param+
-                       dtype-foreign
-                       +unsigned-int-null-pointer+
-                       +oci-attr-data-type+
-                       (deref-vp errhp))
-         (let ((dtype (uffi:deref-pointer dtype-foreign :unsigned-short)))
-           (declare (fixnum dtype))
-           (case dtype
-             (#.SQLT-DATE
-              (setf buffer (acquire-foreign-resource :unsigned-char
-                                                     (* 32 +n-buf-rows+)))
-              (setf sizeof 32 dtype #.SQLT-STR))
-             (#.SQLT-NUMBER
-              (oci-attr-get (deref-vp parmdp)
-                            +oci-dtype-param+
-                            precision
-                            +unsigned-int-null-pointer+
-                            +oci-attr-precision+
-                            (deref-vp errhp))
-              (oci-attr-get (deref-vp parmdp)
-                            +oci-dtype-param+
-                            scale
-                            +unsigned-int-null-pointer+
-                            +oci-attr-scale+
-                            (deref-vp errhp))
-              (let ((*scale (uffi:deref-pointer scale :byte))
-                    (*precision (uffi:deref-pointer precision :short)))
-
-                ;;(format t "scale=~d, precision=~d~%" *scale *precision)
-                (cond
-                 ((or (and (minusp *scale) (zerop *precision))
-                      (and (zerop *scale) (plusp *precision)))
-                  (setf buffer (acquire-foreign-resource :int +n-buf-rows+)
-                        sizeof 4                       ;; sizeof(int)
-                        dtype #.SQLT-INT))
-                 (t
-                  (setf buffer (acquire-foreign-resource :double +n-buf-rows+)
-                        sizeof 8                   ;; sizeof(double)
-                        dtype #.SQLT-FLT)))))
-             ;; Default to SQL-STR
-             (t
-              (setf (uffi:deref-pointer colsize :unsigned-short) 0)
-              (setf dtype #.SQLT-STR)
-              (oci-attr-get (deref-vp parmdp)
-                            +oci-dtype-param+
-                            colsize
-                            +unsigned-int-null-pointer+
-                            +oci-attr-data-size+
-                            (deref-vp errhp))
-              (let ((colsize-including-null (1+ (uffi:deref-pointer colsize :unsigned-short))))
-                (setf buffer (acquire-foreign-resource
-                              :unsigned-char (* +n-buf-rows+ colsize-including-null)))
-                (setf sizeof colsize-including-null))))
-           (let ((retcodes (acquire-foreign-resource :unsigned-short +n-buf-rows+))
-                 (indicators (acquire-foreign-resource :short +n-buf-rows+))
-                 (colname-string ""))
-             (when field-names
-               (oci-attr-get (deref-vp parmdp)
-                             +oci-dtype-param+
-                             colname
-                             colnamelen
-                             +oci-attr-name+
-                             (deref-vp errhp))
-               (setq colname-string (uffi:convert-from-foreign-string
-                                     (uffi:deref-pointer colname '(* :unsigned-char))
-                                     :length (uffi:deref-pointer colnamelen 'ub4))))
-             (push (make-cd :name colname-string
-                            :sizeof sizeof
-                            :buffer buffer
-                            :oci-data-type dtype
-                            :retcodes retcodes
-                            :indicators indicators
-                            :result-type (cond
-                                          ((consp result-types)
-                                           (nth icolumn result-types))
-                                          ((null result-types)
-                                           :string)
-                                          (t
-                                           result-types)))
-                   cds-as-reversed-list)
-             (oci-define-by-pos (deref-vp stmthp)
-                                defnp
-                                (deref-vp errhp)
-                                (1+ icolumn) ; OCI 1-based indexing again
-                                (foreign-resource-buffer buffer)
-                                sizeof
-                                dtype
-                                (foreign-resource-buffer indicators)
-                                +unsigned-short-null-pointer+
-                                (foreign-resource-buffer retcodes)
-                                +oci-default+))))))))
+            (sizeof nil))
+        (do ((icolumn 0 (1+ icolumn))
+             (cds-as-reversed-list nil))
+            ((not (eql (oci-param-get (deref-vp stmthp)
+                                      +oci-htype-stmt+
+                                      (deref-vp errhp)
+                                      parmdp
+                                      (1+ icolumn) :database database)
+                       +oci-success+))
+             (coerce (reverse cds-as-reversed-list) 'simple-vector))
+          ;; Decode type of ICOLUMNth column into a type we're prepared to
+          ;; handle in Lisp.
+          (oci-attr-get (deref-vp parmdp)
+                        +oci-dtype-param+
+                        dtype-foreign
+                        +unsigned-int-null-pointer+
+                        +oci-attr-data-type+
+                        (deref-vp errhp))
+          (let ((dtype (uffi:deref-pointer dtype-foreign :unsigned-short)))
+            (declare (fixnum dtype))
+            (case dtype
+              (#.SQLT-DATE
+               (setf buffer (acquire-foreign-resource :unsigned-char
+                                                      (* 32 +n-buf-rows+)))
+               (setf sizeof 32 dtype #.SQLT-STR))
+              (#.SQLT-NUMBER
+               (oci-attr-get (deref-vp parmdp)
+                             +oci-dtype-param+
+                             precision
+                             +unsigned-int-null-pointer+
+                             +oci-attr-precision+
+                             (deref-vp errhp))
+               (oci-attr-get (deref-vp parmdp)
+                             +oci-dtype-param+
+                             scale
+                             +unsigned-int-null-pointer+
+                             +oci-attr-scale+
+                             (deref-vp errhp))
+               (let ((*scale (uffi:deref-pointer scale :byte))
+                     (*precision (uffi:deref-pointer precision :short)))
+
+                 ;;(format t "scale=~d, precision=~d~%" *scale *precision)
+                 (cond
+                  ((or (and (minusp *scale) (zerop *precision))
+                       (and (zerop *scale) (plusp *precision)))
+                   (setf buffer (acquire-foreign-resource :int +n-buf-rows+)
+                         sizeof 4                       ;; sizeof(int)
+                         dtype #.SQLT-INT))
+                  (t
+                   (setf buffer (acquire-foreign-resource :double +n-buf-rows+)
+                         sizeof 8                   ;; sizeof(double)
+                         dtype #.SQLT-FLT)))))
+              ;; Default to SQL-STR
+              (t
+               (setf (uffi:deref-pointer colsize :unsigned-short) 0)
+               (setf dtype #.SQLT-STR)
+               (oci-attr-get (deref-vp parmdp)
+                             +oci-dtype-param+
+                             colsize
+                             +unsigned-int-null-pointer+
+                             +oci-attr-data-size+
+                             (deref-vp errhp))
+               (let ((colsize-including-null (1+ (uffi:deref-pointer colsize :unsigned-short))))
+                 (setf buffer (acquire-foreign-resource
+                               :unsigned-char (* +n-buf-rows+ colsize-including-null)))
+                 (setf sizeof colsize-including-null))))
+            (let ((retcodes (acquire-foreign-resource :unsigned-short +n-buf-rows+))
+                  (indicators (acquire-foreign-resource :short +n-buf-rows+))
+                  (colname-string ""))
+              (when field-names
+                (oci-attr-get (deref-vp parmdp)
+                              +oci-dtype-param+
+                              colname
+                              colnamelen
+                              +oci-attr-name+
+                              (deref-vp errhp))
+                (setq colname-string (uffi:convert-from-foreign-string
+                                      (uffi:deref-pointer colname '(* :unsigned-char))
+                                      :length (uffi:deref-pointer colnamelen 'ub4))))
+              (push (make-cd :name colname-string
+                             :sizeof sizeof
+                             :buffer buffer
+                             :oci-data-type dtype
+                             :retcodes retcodes
+                             :indicators indicators
+                             :result-type (cond
+                                           ((consp result-types)
+                                            (nth icolumn result-types))
+                                           ((null result-types)
+                                            :string)
+                                           (t
+                                            result-types)))
+                    cds-as-reversed-list)
+              (oci-define-by-pos (deref-vp stmthp)
+                                 defnp
+                                 (deref-vp errhp)
+                                 (1+ icolumn) ; OCI 1-based indexing again
+                                 (foreign-resource-buffer buffer)
+                                 sizeof
+                                 dtype
+                                 (foreign-resource-buffer indicators)
+                                 +unsigned-short-null-pointer+
+                                 (foreign-resource-buffer retcodes)
+                                 +oci-default+))))))))
 
 ;; Release the resources associated with a QUERY-CURSOR.
 
@@ -795,33 +795,33 @@ the length of that format.")
 
       #-oci7
       (oci-env-create envhp +oci-default+ +null-void-pointer+
-                     +null-void-pointer+ +null-void-pointer+
-                     +null-void-pointer+ 0 +null-void-pointer-pointer+)
+                      +null-void-pointer+ +null-void-pointer+
+                      +null-void-pointer+ 0 +null-void-pointer-pointer+)
 
       #+oci7
       (progn
-       (oci-initialize +oci-object+ +null-void-pointer+ +null-void-pointer+
-                       +null-void-pointer+ +null-void-pointer-pointer+)
+        (oci-initialize +oci-object+ +null-void-pointer+ +null-void-pointer+
+                        +null-void-pointer+ +null-void-pointer-pointer+)
         (ignore-errors (oci-handle-alloc +null-void-pointer+ envhp
-                                        +oci-htype-env+ 0
-                                        +null-void-pointer-pointer+)) ;no testing return
+                                         +oci-htype-env+ 0
+                                         +null-void-pointer-pointer+)) ;no testing return
         (oci-env-init envhp +oci-default+ 0 +null-void-pointer-pointer+))
 
       (oci-handle-alloc (deref-vp envhp) errhp
-                       +oci-htype-error+ 0 +null-void-pointer-pointer+)
+                        +oci-htype-error+ 0 +null-void-pointer-pointer+)
       (oci-handle-alloc (deref-vp envhp) srvhp
-                       +oci-htype-server+ 0 +null-void-pointer-pointer+)
+                        +oci-htype-server+ 0 +null-void-pointer-pointer+)
 
       (let ((db (make-instance 'oracle-database
-                 :name (database-name-from-spec connection-spec
-                                                database-type)
-                 :connection-spec connection-spec
-                 :envhp envhp
-                 :errhp errhp
-                 :database-type :oracle
-                 :svchp svchp
-                 :dsn data-source-name
-                 :user user)))
+                  :name (database-name-from-spec connection-spec
+                                                 database-type)
+                  :connection-spec connection-spec
+                  :envhp envhp
+                  :errhp errhp
+                  :database-type :oracle
+                  :svchp svchp
+                  :dsn data-source-name
+                  :user user)))
         (uffi:with-foreign-strings ((c-user user)
                                     (c-password password)
                                     (c-data-source-name data-source-name))
@@ -832,16 +832,16 @@ the length of that format.")
                      c-password (length password)
                      c-data-source-name (length data-source-name)
                      :database db))
-       ;; :date-format-length (1+ (length date-format)))))
-       (setf (slot-value db 'clsql-sys::state) :open)
+        ;; :date-format-length (1+ (length date-format)))))
+        (setf (slot-value db 'clsql-sys::state) :open)
         (database-execute-command
-        (format nil "ALTER SESSION SET NLS_DATE_FORMAT='~A'" (date-format db)) db)
-       (let ((server-version
-              (caar (database-query
-                     "SELECT BANNER FROM V$VERSION WHERE BANNER LIKE '%Oracle%'" db nil nil))))
-         (setf (slot-value db 'server-version) server-version
-               (slot-value db 'major-server-version) (major-client-version-from-string
-                                                      server-version)))
+         (format nil "ALTER SESSION SET NLS_DATE_FORMAT='~A'" (date-format db)) db)
+        (let ((server-version
+               (caar (database-query
+                      "SELECT BANNER FROM V$VERSION WHERE BANNER LIKE '%Oracle%'" db nil nil))))
+          (setf (slot-value db 'server-version) server-version
+                (slot-value db 'major-server-version) (major-client-version-from-string
+                                                       server-version)))
         db))))
 
 
@@ -869,7 +869,7 @@ the length of that format.")
 
 (defmethod database-disconnect ((database oracle-database))
   (osucc (oci-logoff (deref-vp (svchp database))
-                    (deref-vp (errhp database))))
+                     (deref-vp (errhp database))))
   (osucc (oci-handle-free (deref-vp (envhp database)) +oci-htype-env+))
   ;; Note: It's neither required nor allowed to explicitly deallocate the
   ;; ERRHP handle here, since it's owned by the ENVHP deallocated above,
@@ -892,19 +892,19 @@ the length of that format.")
   (let ((cursor (sql-stmt-exec query-expression database result-types field-names)))
     ;; (declare (type (or query-cursor null) cursor))
     (if (null cursor) ; No table was returned.
-       (values)
+        (values)
       (do ((reversed-result nil))
-         (nil)
-       (let* ((eof-value :eof)
-              (row (fetch-row cursor nil eof-value)))
-         (when (eq row eof-value)
-           (close-query cursor)
-           (if field-names
-               (return (values (nreverse reversed-result)
-                               (loop for cd across (qc-cds cursor)
-                                   collect (cd-name cd))))
-             (return (nreverse reversed-result))))
-         (push row reversed-result))))))
+          (nil)
+        (let* ((eof-value :eof)
+               (row (fetch-row cursor nil eof-value)))
+          (when (eq row eof-value)
+            (close-query cursor)
+            (if field-names
+                (return (values (nreverse reversed-result)
+                                (loop for cd across (qc-cds cursor)
+                                    collect (cd-name cd))))
+              (return (nreverse reversed-result))))
+          (push row reversed-result))))))
 
 
 (defmethod database-create-sequence (sequence-name (database oracle-database))
@@ -919,26 +919,26 @@ the length of that format.")
 
 (defmethod database-sequence-next (sequence-name (database oracle-database))
   (caar (database-query
-        (concatenate 'string "SELECT "
-                     (sql-escape sequence-name)
-                     ".NEXTVAL FROM dual")
-        database :auto nil)))
+         (concatenate 'string "SELECT "
+                      (sql-escape sequence-name)
+                      ".NEXTVAL FROM dual")
+         database :auto nil)))
 
 (defmethod database-sequence-last (sequence-name (database oracle-database))
   (caar (database-query
-        (concatenate 'string "SELECT "
-                     (sql-escape sequence-name)
-                     ".CURRVAL FROM dual")
-        database :auto nil)))
+         (concatenate 'string "SELECT "
+                      (sql-escape sequence-name)
+                      ".CURRVAL FROM dual")
+         database :auto nil)))
 
 (defmethod database-set-sequence-position (name position (database oracle-database))
   (without-interrupts
    (let* ((next (database-sequence-next name database))
-         (incr (- position next)))
+          (incr (- position next)))
      (unless (zerop incr)
        (database-execute-command
-       (format nil "ALTER SEQUENCE ~A INCREMENT BY ~D" name incr)
-       database))
+        (format nil "ALTER SEQUENCE ~A INCREMENT BY ~D" name incr)
+        database))
      (database-sequence-next name database)
      (database-execute-command
       (format nil "ALTER SEQUENCE ~A INCREMENT BY 1" name)
@@ -946,7 +946,7 @@ the length of that format.")
 
 (defmethod database-list-sequences ((database oracle-database) &key owner)
   (let ((query
-        (cond ((null owner)
+         (cond ((null owner)
                 "select sequence_name from user_sequences")
                ((eq owner :all)
                 "select sequence_name from all_sequences")
@@ -964,7 +964,7 @@ the length of that format.")
 
 
 (defstruct (cd (:constructor make-cd)
-              (:print-function print-cd))
+               (:print-function print-cd))
   "a column descriptor: metadata about the data in a table"
 
   ;; name of this column
@@ -973,33 +973,33 @@ the length of that format.")
   (sizeof (error "missing SIZE") :type fixnum :read-only t)
   ;; an array of +N-BUF-ROWS+ elements in C representation
   (buffer (error "Missing BUFFER")
-         :type foreign-resource
-         :read-only t)
+          :type foreign-resource
+          :read-only t)
   ;; an array of +N-BUF-ROWS+ OCI return codes in C representation.
   ;; (There must be one return code for every element of every
   ;; row in order to be able to represent nullness.)
   (retcodes (error "Missing RETCODES")
-           :type foreign-resource
-           :read-only t)
+            :type foreign-resource
+            :read-only t)
   (indicators (error "Missing INDICATORS")
-             :type foreign-resource
-             :read-only t)
+              :type foreign-resource
+              :read-only t)
   ;; the OCI code for the data type of a single element
   (oci-data-type (error "missing OCI-DATA-TYPE")
-                :type fixnum
-                :read-only t)
+                 :type fixnum
+                 :read-only t)
   (result-type (error "missing RESULT-TYPE")
-              :read-only t))
+               :read-only t))
 
 
 (defun print-cd (cd stream depth)
   (declare (ignore depth))
   (print-unreadable-object (cd stream :type t)
     (format stream
-           ":NAME ~S :OCI-DATA-TYPE ~S :OCI-DATA-SIZE ~S"
-           (cd-name cd)
-           (cd-oci-data-type cd)
-           (cd-sizeof cd))))
+            ":NAME ~S :OCI-DATA-TYPE ~S :OCI-DATA-SIZE ~S"
+            (cd-name cd)
+            (cd-oci-data-type cd)
+            (cd-sizeof cd))))
 
 (defun print-query-cursor (qc stream depth)
   (declare (ignore depth))
@@ -1008,12 +1008,12 @@ the length of that format.")
 
 
 (defmethod database-query-result-set ((query-expression string)
-                                     (database oracle-database)
-                                     &key full-set result-types)
+                                      (database oracle-database)
+                                      &key full-set result-types)
   (let ((cursor (sql-stmt-exec query-expression database result-types nil)))
     (if full-set
-       (values cursor (length (qc-cds cursor)) nil)
-       (values cursor (length (qc-cds cursor))))))
+        (values cursor (length (qc-cds cursor)) nil)
+        (values cursor (length (qc-cds cursor))))))
 
 
 (defmethod database-dump-result-set (result-set (database oracle-database))
@@ -1021,10 +1021,10 @@ the length of that format.")
 
 (defmethod database-store-next-row (result-set (database oracle-database) list)
   (let* ((eof-value :eof)
-        (row (fetch-row result-set nil eof-value)))
+         (row (fetch-row result-set nil eof-value)))
     (unless (eq eof-value row)
       (loop for i from 0 below (length row)
-         do (setf (nth i list) (nth i row)))
+          do (setf (nth i list) (nth i row)))
       list)))