X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-odbc%2Fodbc-sql.lisp;h=51d366b9360ccd2de9eab7e3b1ed4119127e152c;hb=3ec4277531c7c19b1cffade823d3e2e3f928ceb3;hp=2fad84805755c8c3b029d553b899f8d677812978;hpb=db9892632e6eb7869aea7a94c16b523a82de1501;p=clsql.git diff --git a/db-odbc/odbc-sql.lisp b/db-odbc/odbc-sql.lisp index 2fad848..51d366b 100644 --- a/db-odbc/odbc-sql.lisp +++ b/db-odbc/odbc-sql.lisp @@ -60,6 +60,9 @@ :errno nil :error "Connection failed"))))) +(defmethod database-underlying-type ((database odbc-database)) + (odbc-db-type database)) + (defun store-type-of-connected-database (db) (let* ((odbc-conn (database-odbc-conn db)) (server-name (odbc-dbi::get-odbc-info odbc-conn odbc::$SQL_SERVER_NAME)) @@ -286,17 +289,33 @@ &key (owner nil)) (let ((result '())) (dolist (table (database-list-tables database :owner owner) result) - (append (database-list-table-indexes table database :owner owner) - result)))) + (setq result + (append (database-list-table-indexes table database :owner owner) + result))))) (defmethod database-list-table-indexes (table (database odbc-database) &key (owner nil)) + (declare (ignore owner)) (multiple-value-bind (rows col-names) - (odbc-dbi:list-table-indexes table :db (database-odbc-conn database)) + (odbc-dbi:list-table-indexes + (string-downcase table) + :db (database-odbc-conn database)) (declare (ignore col-names)) ;; INDEX_NAME is hard-coded in sixth position by ODBC driver - (loop for row in rows collect (nth 5 row)))) + ;; FIXME: ??? is hard-coded in the fourth position + (do ((results nil) + (loop-rows rows (cdr loop-rows))) + ((null loop-rows) (nreverse results)) + (let* ((row (car loop-rows)) + (col (nth 5 row)) + (type (nth 3 row))) + (unless (or (find col results :test #'string-equal) + #+ignore (equal "0" type)) + (push col results)))))) + +(defmethod database-initialize-database-type ((database-type (eql :odbc))) + ;; nothing to do + t) -#+ignore (when (clsql-base-sys:database-type-library-loaded :odbc) (clsql-base-sys:initialize-database-type :database-type :odbc))