r9279: Handle differences in direct-slot-definition values which
[clsql.git] / tests / test-init.lisp
index 99c3a47c5abbd215a1f472ba7700d2d3c22fd097..c899867e2ea46dd2ffce5563906231ec40615e59 100644 (file)
     :accessor employee-email
     :type (string 100)
     :initarg :email)
-   (companyid
+   (ecompanyid
     :type integer
     :initarg :companyid)
    (company
     :accessor employee-company
     :db-kind :join
     :db-info (:join-class company
-                         :home-key companyid
+                         :home-key ecompanyid
                          :foreign-key companyid
                          :set nil))
    (managerid
@@ -89,7 +89,7 @@
     :db-kind :join
     :db-info (:join-class employee-address
                          :home-key emplid
-                         :foreign-key emplid
+                         :foreign-key aemplid
                          :target-slot address
                          :set t)))
   (:base-table employee))
     :db-kind :join
     :db-info (:join-class employee
                          :home-key (companyid groupid)
-                         :foreign-key (companyid groupid)
-                         :set t)))
-  (:base-table company))
-
+                         :foreign-key (ecompanyid groupid)
+                         :set t))))
 
 (def-view-class address ()
   ((addressid
     :column "zip"
     :type integer
     :void-value 0
-    :initarg :postal-code)))
+    :initarg :postal-code))
+  (:base-table addr))
 
 ;; many employees can reside at many addressess
 (def-view-class employee-address ()
-  ((emplid :type integer
-          :initarg :emplid)
-   (addressid :type integer
-             :initarg :addressid)
+  ((aemplid :type integer :initarg :emplid)
+   (aaddressid :type integer :initarg :addressid)
+   (verified :type boolean :initarg :verified)
    (address :db-kind :join
            :db-info (:join-class address
-                                 :home-key addressid
+                                 :home-key aaddressid
                                  :foreign-key addressid
-                                 :retrieval :immediate))))
+                                 :retrieval :immediate)))
+  (:base-table "ea_join"))
 
 (defun test-connect-to-database (db-type spec)
   (when (db-backend-has-create/destroy-db? db-type)
                                  :addressid 2)
          employee-address1 (make-instance 'employee-address
                                           :emplid 1
-                                          :addressid 1)
+                                          :addressid 1
+                                          :verified t)
          employee-address2 (make-instance 'employee-address
                                           :emplid 2
-                                          :addressid 2)
+                                          :addressid 2
+                                          :verified t)
          employee-address3 (make-instance 'employee-address
                                           :emplid 3
-                                          :addressid 1)
+                                          :addressid 1
+                                          :verified nil)
          employee-address4 (make-instance 'employee-address
                                           :emplid 1
-                                          :addressid 2)
+                                          :addressid 2
+                                          :verified nil)
          employee-address5 (make-instance 'employee-address
                                           :emplid 3
                                           :addressid 2)
       (disconnect :database *default-database*))
   (test-connect-to-database :postgresql (car (postgresql-spec (read-specs))))
   (test-initialise-database))
+
+(defun rlm ()
+  "Rapid load for interactive testing."
+  (when *default-database*
+      (disconnect :database *default-database*))
+  (test-connect-to-database :mysql (car (mysql-spec (read-specs))))
+  (test-initialise-database))