projects
/
clsql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
48a9de8
)
r9522: * sql/odbc-api.lisp: Update to using ODBC V3 protocol
author
Kevin M. Rosenberg
<kevin@rosenberg.net>
Sun, 30 May 2004 08:01:53 +0000
(08:01 +0000)
committer
Kevin M. Rosenberg
<kevin@rosenberg.net>
Sun, 30 May 2004 08:01:53 +0000
(08:01 +0000)
ChangeLog
patch
|
blob
|
history
db-odbc/odbc-api.lisp
patch
|
blob
|
history
db-odbc/odbc-constants.lisp
patch
|
blob
|
history
db-odbc/odbc-dbi.lisp
patch
|
blob
|
history
db-odbc/odbc-sql.lisp
patch
|
blob
|
history
sql/generic-odbc.lisp
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index 711551d939aaedbab8581261ab1e8c78dd41795c..6a7e1af7851ca23bb61471b236ccf0dca3eeb055 100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-10,6
+10,7
@@
* sql/generic-postgresql.lisp: Add support for
prepared statements.
* tests/test-internal.lisp: New file
* sql/generic-postgresql.lisp: Add support for
prepared statements.
* tests/test-internal.lisp: New file
+ * sql/odbc-api.lisp: Update to using ODBC V3 protocol
27 May 2004 Kevin Rosenberg <kevin@rosenberg.net>
* Version 2.11.3
27 May 2004 Kevin Rosenberg <kevin@rosenberg.net>
* Version 2.11.3
diff --git
a/db-odbc/odbc-api.lisp
b/db-odbc/odbc-api.lisp
index b17af024651a85554ea5d8ce8754fb7d83d7e4c0..492bf826f6dcfaedff31eac124d7da4b5e36a737 100644
(file)
--- a/
db-odbc/odbc-api.lisp
+++ b/
db-odbc/odbc-api.lisp
@@
-153,7
+153,7
@@
as possible second argument) to the desired representation of date/time/timestam
()
(SQLAllocEnv phenv)
(deref-pointer phenv 'sql-handle)))))
()
(SQLAllocEnv phenv)
(deref-pointer phenv 'sql-handle)))))
- (%set-attr-odbc-version henv $SQL_OV_ODBC
2
)
+ (%set-attr-odbc-version henv $SQL_OV_ODBC
3
)
henv))
henv))
@@
-568,6
+568,9
@@
as possible second argument) to the desired representation of date/time/timestam
(#.$SQL_DATE $SQL_C_DATE)
(#.$SQL_TIME $SQL_C_TIME)
(#.$SQL_TIMESTAMP $SQL_C_TIMESTAMP)
(#.$SQL_DATE $SQL_C_DATE)
(#.$SQL_TIME $SQL_C_TIME)
(#.$SQL_TIMESTAMP $SQL_C_TIMESTAMP)
+ (#.$SQL_TYPE_DATE $SQL_C_TYPE_DATE)
+ (#.$SQL_TYPE_TIME $SQL_C_TYPE_TIME)
+ (#.$SQL_TYPE_TIMESTAMP $SQL_C_TYPE_TIMESTAMP)
((#.$SQL_BINARY #.$SQL_VARBINARY #.$SQL_LONGVARBINARY) $SQL_C_BINARY)
(#.$SQL_TINYINT $SQL_C_STINYINT)
(#.$SQL_BIT $SQL_C_BIT)))
((#.$SQL_BINARY #.$SQL_VARBINARY #.$SQL_LONGVARBINARY) $SQL_C_BINARY)
(#.$SQL_TINYINT $SQL_C_STINYINT)
(#.$SQL_BIT $SQL_C_BIT)))
@@
-650,12
+653,12
@@
as possible second argument) to the desired representation of date/time/timestam
(read-from-string (get-cast-foreign-string data-ptr))))
(t
(case c-type
(read-from-string (get-cast-foreign-string data-ptr))))
(t
(case c-type
- (
#.$SQL_C_DATE
+ (
(#.$SQL_C_DATE #.$SQL_C_TYPE_DATE)
(funcall *time-conversion-function* (date-to-universal-time data-ptr)))
(funcall *time-conversion-function* (date-to-universal-time data-ptr)))
- (
#.$SQL_C_TIME
+ (
(#.$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)))
(multiple-value-bind (universal-time frac) (time-to-universal-time data-ptr)
(funcall *time-conversion-function* universal-time frac)))
- (
#.$SQL_C_TIMESTAMP
+ (
(#.$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
(multiple-value-bind (universal-time frac) (timestamp-to-universal-time data-ptr)
(funcall *time-conversion-function* universal-time frac)))
(#.$SQL_INTEGER
@@
-705,9
+708,9
@@
as possible second argument) to the desired representation of date/time/timestam
(data-ptr
(case c-type ;; add more?
(#.$SQL_C_SLONG (uffi:allocate-foreign-object #.$ODBC-LONG-TYPE))
(data-ptr
(case c-type ;; add more?
(#.$SQL_C_SLONG (uffi:allocate-foreign-object #.$ODBC-LONG-TYPE))
- (
#.$SQL_C_DATE
(allocate-foreign-object 'sql-c-date))
- (
#.$SQL_C_TIME
(allocate-foreign-object 'sql-c-time))
- (
#.$SQL_C_TIMESTAMP
(allocate-foreign-object 'sql-c-timestamp))
+ (
(#.$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_DOUBLE (uffi:allocate-foreign-object :double))
(#.$SQL_C_BIT (uffi:allocate-foreign-object :byte))
(#.$SQL_C_FLOAT (uffi:allocate-foreign-object :float))
(#.$SQL_C_DOUBLE (uffi:allocate-foreign-object :double))
(#.$SQL_C_BIT (uffi:allocate-foreign-object :byte))
diff --git
a/db-odbc/odbc-constants.lisp
b/db-odbc/odbc-constants.lisp
index c16e2a76869201da13e5b15add9ea95147fdc129..591a3afa43fcc76c0f7a3f0df4e15bbd62652eae 100644
(file)
--- a/
db-odbc/odbc-constants.lisp
+++ b/
db-odbc/odbc-constants.lisp
@@
-894,6
+894,11
@@
(defconstant $SQL_TINYINT -6)
(defconstant $SQL_BIT -7)
(defconstant $SQL_TINYINT -6)
(defconstant $SQL_BIT -7)
+;; For ODBC3
+(defconstant $SQL_TYPE_DATE 91)
+(defconstant $SQL_TYPE_TIME 92)
+(defconstant $SQL_TYPE_TIMESTAMP 93)
+
(defconstant $SQL_INTERVAL_YEAR -80)
(defconstant $SQL_INTERVAL_MONTH -81)
(defconstant $SQL_INTERVAL_YEAR_TO_MONTH -82)
(defconstant $SQL_INTERVAL_YEAR -80)
(defconstant $SQL_INTERVAL_MONTH -81)
(defconstant $SQL_INTERVAL_YEAR_TO_MONTH -82)
@@
-930,6
+935,11
@@
(defconstant $SQL_C_UTINYINT (+ $SQL_TINYINT $SQL_UNSIGNED_OFFSET)) ;;UNSIGNED TINYINT
(defconstant $SQL_C_BOOKMARK $SQL_C_ULONG) ;; BOOKMARK
(defconstant $SQL_C_UTINYINT (+ $SQL_TINYINT $SQL_UNSIGNED_OFFSET)) ;;UNSIGNED TINYINT
(defconstant $SQL_C_BOOKMARK $SQL_C_ULONG) ;; BOOKMARK
+;;; ODBC3
+(defconstant $SQL_C_TYPE_DATE $SQL_TYPE_DATE)
+(defconstant $SQL_C_TYPE_TIME $SQL_TYPE_TIME)
+(defconstant $SQL_C_TYPE_TIMESTAMP $SQL_TYPE_TIMESTAMP)
+
;; Options for SQLDriverConnect
(defconstant $SQL_DRIVER_NOPROMPT 0)
(defconstant $SQL_DRIVER_COMPLETE 1)
;; Options for SQLDriverConnect
(defconstant $SQL_DRIVER_NOPROMPT 0)
(defconstant $SQL_DRIVER_COMPLETE 1)
diff --git
a/db-odbc/odbc-dbi.lisp
b/db-odbc/odbc-dbi.lisp
index 634a43e2601f101cc9b19e51d6aea0be108925a5..fc8f3000bed3380d7e0677bab1b7b625e398999b 100644
(file)
--- a/
db-odbc/odbc-dbi.lisp
+++ b/
db-odbc/odbc-dbi.lisp
@@
-559,9
+559,9
@@
This makes the functions db-execute-command and db-query thread safe."
(#.odbc::$SQL_SMALLINT :short)
((#.odbc::$SQL_FLOAT #.odbc::$SQL_DOUBLE) #.odbc::$ODBC-LONG-TYPE)
(#.odbc::$SQL_REAL #.odbc::$ODBC-LONG-TYPE)
(#.odbc::$SQL_SMALLINT :short)
((#.odbc::$SQL_FLOAT #.odbc::$SQL_DOUBLE) #.odbc::$ODBC-LONG-TYPE)
(#.odbc::$SQL_REAL #.odbc::$ODBC-LONG-TYPE)
- (
#.odbc::$SQL_DATE
'sql-c-date)
- (
#.odbc::$SQL_TIME
'sql-c-time)
- (
#.odbc::$SQL_TIMESTAMP
'sql-c-timestamp)
+ (
(#.odbc::$SQL_DATE #.odbc::$SQL_TYPE_DATE)
'sql-c-date)
+ (
(#.odbc::$SQL_TIME #.odbc::$SQL_TYPE_TIME)
'sql-c-time)
+ (
(#.odbc::$SQL_TIMESTAMP #.odbc::$SQL_TYPE_TIMESTAMP)
'sql-c-timestamp)
;;((#.odbc::$SQL_BINARY #.odbc::$SQL_VARBINARY #.odbc::$SQL_LONGVARBINARY) odbc::$SQL_C_BINARY) ; ??
(#.odbc::$SQL_TINYINT :short)
;;(#.odbc::$SQL_BIT odbc::$SQL_C_BIT) ; ??
;;((#.odbc::$SQL_BINARY #.odbc::$SQL_VARBINARY #.odbc::$SQL_LONGVARBINARY) odbc::$SQL_C_BINARY) ; ??
(#.odbc::$SQL_TINYINT :short)
;;(#.odbc::$SQL_BIT odbc::$SQL_C_BIT) ; ??
diff --git
a/db-odbc/odbc-sql.lisp
b/db-odbc/odbc-sql.lisp
index e1ad0c234d03333177ae3c4798777880076ef1ef..9f88a9c6e751d7b8c8b1d8ad8b19306d64f73042 100644
(file)
--- a/
db-odbc/odbc-sql.lisp
+++ b/
db-odbc/odbc-sql.lisp
@@
-48,6
+48,9
@@
:password password
:data-source-name dsn))))
(store-type-of-connected-database db)
:password password
:data-source-name dsn))))
(store-type-of-connected-database db)
+ ;; Ensure this database type is initialized so can check capabilities of
+ ;; underlying database
+ (initialize-database-type :database-type db-type)
db)
(error () ;; Init or Connect failed
(error 'sql-connection-error
db)
(error () ;; Init or Connect failed
(error 'sql-connection-error
diff --git
a/sql/generic-odbc.lisp
b/sql/generic-odbc.lisp
index d22255070c7d2c6504a860c695cbc63d4c2db1d9..06338ae605013a9fec962504f8deb7d3f65b7f19 100644
(file)
--- a/
sql/generic-odbc.lisp
+++ b/
sql/generic-odbc.lisp
@@
-67,6
+67,7
@@
query-expression :db (odbc-conn database)
:result-types result-types
:column-names field-names)
query-expression :db (odbc-conn database)
:result-types result-types
:column-names field-names)
+ #+ignore
(error ()
(error 'sql-database-data-error
:database database
(error ()
(error 'sql-database-data-error
:database database