X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-aodbc%2Faodbc-sql.lisp;h=22aa329b4b1c4fc706790e91bb1f6850c8377641;hb=947d861d8857ce104a5c61ba993c3cf468a730d8;hp=09815914083be6190bab705eeb1ce986027ec372;hpb=d0f147d0e7d942b379bd7cd472f26b00c33916bc;p=clsql.git diff --git a/db-aodbc/aodbc-sql.lisp b/db-aodbc/aodbc-sql.lisp index 0981591..22aa329 100644 --- a/db-aodbc/aodbc-sql.lisp +++ b/db-aodbc/aodbc-sql.lisp @@ -37,7 +37,8 @@ ;; AODBC interface (defclass aodbc-database (database) - ((aodbc-conn :accessor database-aodbc-conn :initarg :aodbc-conn))) + ((aodbc-conn :accessor database-aodbc-conn :initarg :aodbc-conn) + (aodbc-db-type :accessor database-aodbc-db-type :initform :unknown))) (defmethod database-name-from-spec (connection-spec (database-type (eql :aodbc))) @@ -194,11 +195,27 @@ #+aodbc-v2 (multiple-value-bind (rows col-names) (dbi:list-all-database-tables :db (database-aodbc-conn database)) - (let ((pos (position "TABLE_NAME" col-names :test #'string-equal))) - (when pos - (loop for row in rows - collect (nth pos row)))))) - + (declare (ignore col-names)) + ;; TABLE_SCHEM is hard-coded in second column by ODBC Driver Manager + ;; TABLE_NAME in third column, TABLE_TYPE in fourth column + (loop for row in rows + when (and (not (string-equal "information_schema" (nth 1 row))) + (string-equal "TABLE" (nth 3 row))) + collect (nth 2 row)))) + +(defmethod database-list-views ((database aodbc-database) + &key (owner nil)) + (declare (ignore owner)) + #+aodbc-v2 + (multiple-value-bind (rows col-names) + (dbi:list-all-database-tables :db (database-aodbc-conn database)) + (declare (ignore col-names)) + ;; TABLE_SCHEM is hard-coded in second column by ODBC Driver Manager + ;; TABLE_NAME in third column, TABLE_TYPE in fourth column + (loop for row in rows + when (and (not (string-equal "information_schema" (nth 1 row))) + (string-equal "VIEW" (nth 3 row))) + collect (nth 2 row)))) (defmethod database-list-attributes ((table string) (database aodbc-database) &key (owner nil)) @@ -222,6 +239,11 @@ (loop for row in rows collect (nth pos row)))))) +(defmethod database-list-indexes ((database aodbc-database) + &key (owner nil)) + (warn "database-list-indexes not implemented for AODBC.") + nil) + (defmethod database-set-sequence-position (sequence-name (position integer) (database aodbc-database)) @@ -271,6 +293,14 @@ (defmethod database-probe (connection-spec (type (eql :aodbc))) (warn "Not implemented.")) +;;; Backend capabilities + +(defmethod database-underlying-type ((database aodbc-database)) + (database-aodbc-db-type database)) + +(defmethod db-backend-has-create/destroy-db? ((db-type (eql :aodbc))) + nil) + #+ignore (when (clsql-base-sys:database-type-library-loaded :aodbc) (clsql-base-sys:initialize-database-type :database-type :aodbc))