r9128: all multiple specs for a given backend
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 22 Apr 2004 05:50:46 +0000 (05:50 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 22 Apr 2004 05:50:46 +0000 (05:50 +0000)
db-aodbc/aodbc-sql.lisp
tests/test-basic.lisp
tests/test-init.lisp
tests/utils.lisp

index 22aa329b4b1c4fc706790e91bb1f6850c8377641..18a23841353ad4a5846a14d5371599bd6ef0d6d4 100644 (file)
 (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))
index 34b3f25ffe60bbf9d43db3fc5281ac66b84e1b2f..a6a501ec1a3e8606d2d7eb9988fadada71565b9c 100644 (file)
   (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)
index 461f0f82dda613037fc1d2cf9b1523f3352f5e5b..585df962cdb3a0dc443e03d9402b04082c40e629 100644 (file)
 
 
 
-(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*)
 
                     :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)
       (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)
index bd51cb84ac32798e27789b7d5cb4fff37d740f07..6b5d38e64606fe4406e1703801b81e52c2c4dabb 100644 (file)
                 :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)))