From: Kevin M. Rosenberg Date: Thu, 22 Apr 2004 05:50:46 +0000 (+0000) Subject: r9128: all multiple specs for a given backend X-Git-Tag: v3.8.6~590 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=86440ca219f801a087ad917d1c1f46c77c920aa4 r9128: all multiple specs for a given backend --- diff --git a/db-aodbc/aodbc-sql.lisp b/db-aodbc/aodbc-sql.lisp index 22aa329..18a2384 100644 --- a/db-aodbc/aodbc-sql.lisp +++ b/db-aodbc/aodbc-sql.lisp @@ -185,9 +185,8 @@ (defmethod database-list-sequences ((database aodbc-database) &key (owner nil)) (declare (ignore owner)) - (mapcar #'(lambda (s) (%table-name-to-sequence-name (car s))) - (database-query "SHOW TABLES LIKE '%clsql_seq%'" - database nil))) + (warn "database-list-sequences not implemented for AODBC.") + nil) (defmethod database-list-tables ((database aodbc-database) &key (owner nil)) diff --git a/tests/test-basic.lisp b/tests/test-basic.lisp index 34b3f25..a6a501e 100644 --- a/tests/test-basic.lisp +++ b/tests/test-basic.lisp @@ -165,10 +165,6 @@ (let ((*read-default-float-format* 'double-float)) (coerce (read-from-string num-str) 'double-float))) -(defun test-table-row (row types) -) - - (defun double-float-equal (a b) (if (zerop a) (if (zerop b) diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 461f0f8..585df96 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -121,25 +121,23 @@ -(defun test-connect-to-database (db-type) - (let ((spec (db-type-spec db-type (read-specs)))) - (when (db-backend-has-create/destroy-db? db-type) - (ignore-errors (destroy-database spec :database-type db-type)) - (ignore-errors (create-database spec :database-type db-type))) - - - (setf *test-database-type* db-type) - (when (>= (length spec) 3) - (setq *test-database-user* (third spec))) - - ;; Connect to the database - (clsql:connect spec - :database-type db-type - :make-default t - :if-exists :old)) +(defun test-connect-to-database (db-type spec) + (when (db-backend-has-create/destroy-db? db-type) + (ignore-errors (destroy-database spec :database-type db-type)) + (ignore-errors (create-database spec :database-type db-type))) + + (setf *test-database-type* db-type) + (when (>= (length spec) 3) + (setq *test-database-user* (third spec))) + + ;; Connect to the database + (clsql:connect spec + :database-type db-type + :make-default t + :if-exists :old) (setf *test-database-underlying-type* - (clsql-sys:database-underlying-type *default-database*)) + (clsql-sys:database-underlying-type *default-database*)) *default-database*) @@ -261,7 +259,10 @@ :first-name "Vladamir" :last-name "Putin" :email "putin@soviet.org")) - + + ;; sleep to ensure birthdays are no longer at current time + (sleep 2) + ;; Lenin manages everyone (clsql:add-to-relation employee2 'manager employee1) (clsql:add-to-relation employee3 'manager employee1) @@ -314,19 +315,17 @@ (return-from run-tests :skipped)) (load-necessary-systems specs) (dolist (db-type +all-db-types+) - (unless (and (eq db-type :aodbc) - (not (member :allegro cl:*features*))) - (when (db-type-spec db-type specs) - (do-tests-for-backend db-type)))) - (zerop *error-count*))) + (dolist (spec (db-type-spec db-type specs)) + (do-tests-for-backend db-type spec)))) + (zerop *error-count*)) (defun load-necessary-systems (specs) (dolist (db-type +all-db-types+) (when (db-type-spec db-type specs) (db-type-ensure-system db-type)))) -(defun do-tests-for-backend (db-type) - (test-connect-to-database db-type) +(defun do-tests-for-backend (db-type spec) + (test-connect-to-database db-type spec) (unwind-protect (multiple-value-bind (test-forms skip-tests) diff --git a/tests/utils.lisp b/tests/utils.lisp index bd51cb8..6b5d38e 100644 --- a/tests/utils.lisp +++ b/tests/utils.lisp @@ -24,28 +24,28 @@ :type "config")) (defvar +all-db-types+ - #-clisp '(:postgresql :postgresql-socket :sqlite :mysql :odbc :aodbc) + #-clisp '(:postgresql :postgresql-socket :sqlite :mysql :odbc + #+allegro :aodbc) #+clisp '(:sqlite)) (defclass conn-specs () - ((aodbc-spec :accessor aodbc-spec :initform nil) - (odbc-spec :accessor odbc-spec :initform nil) - (mysql-spec :accessor mysql-spec :initform nil) - (postgresql-spec :accessor postgresql-spec :initform nil) - (postgresql-socket-spec :accessor postgresql-socket-spec :initform nil) - (sqlite-spec :accessor sqlite-spec :initform nil)) + ((aodbc :accessor aodbc-spec :initform nil) + (odbc :accessor odbc-spec :initform nil) + (mysql :accessor mysql-spec :initform nil) + (postgresql :accessor postgresql-spec :initform nil) + (postgresql-socket :accessor postgresql-socket-spec :initform nil) + (sqlite :accessor sqlite-spec :initform nil)) (:documentation "Connection specs for CLSQL testing")) (defun read-specs (&optional (path *config-pathname*)) (if (probe-file path) (with-open-file (stream path :direction :input) - (let ((config (read stream)) - (specs (make-instance 'conn-specs))) - (dolist (db-type +all-db-types+) - (setf (slot-value specs (spec-fn db-type)) - (cadr (assoc db-type config)))) - specs)) + (let ((specs (make-instance 'conn-specs))) + (dolist (spec (read stream) specs) + (push (second spec) + (slot-value specs (intern (symbol-name (first spec)) + (find-package '#:clsql-tests))))))) (progn (warn "CLSQL test config file ~S not found" path) nil)))