- (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))))
- (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)
- (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))
+ (let ((db (make-instance 'odbc-database
+ :name (database-name-from-spec connection-spec :odbc)
+ :database-type :odbc
+ :connection-spec connection-spec
+ :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)
+ (if (eql :postgresql (database-underlying-type db))
+ (make-instance 'odbc-postgresql-database
+ :name (database-name-from-spec connection-spec :odbc)
+ :database-type :odbc
+ :connection-spec connection-spec
+ :dbi-package (find-package '#:odbc-dbi)
+ :odbc-db-type :postgresql
+ :odbc-conn (clsql-sys::odbc-conn db))
+ db))
+ #+ignore
+ (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 generic-odbc-database))
+ (clsql-sys::database-odbc-db-type database))