r9485: 26 May 2004 Kevin Rosenberg <kevin@rosenberg.net>
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 27 May 2004 10:49:50 +0000 (10:49 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 27 May 2004 10:49:50 +0000 (10:49 +0000)
        * sql/oodml.lisp: Commit universal-time typo patch from Edi Weitz
        * test/test-init.lisp: Add universal-time slot to person.
        * test/test-fddl.lisp: Add tests of universal-time slot
        * test/test-ooddl.lisp: Test universal-time slot in an object
        * TODO: Remove need for universal-time test
        * debian/rules, debian/control: Add cl-sql-oracle binary package

ChangeLog
TODO
debian/changelog
debian/control
sql/oodml.lisp
tests/test-fddl.lisp
tests/test-fdml.lisp
tests/test-init.lisp
tests/test-ooddl.lisp

index be86ce13a65a62d924f64df4741022a7933a344f..69b6f6e461c9b8d382d85e20ddcd4654307851d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+26 May 2004 Kevin Rosenberg <kevin@rosenberg.net>
+       * sql/oodml.lisp: Commit universal-time typo patch from Edi Weitz
+       * test/test-init.lisp: Add universal-time slot to person.
+       * test/test-fddl.lisp: Add tests of universal-time slot
+       * test/test-ooddl.lisp: Test universal-time slot in an object
+       * TODO: Remove need for universal-time test     
+       * debian/rules, debian/control: Add cl-sql-oracle binary package
+       
 25 May 2004 Kevin Rosenberg <kevin@rosenberg.net>
        * sql/oodml.lisp: (string n) now produces a CHAR field. Add new VARCHAR
        type. Added *default-varchar-length* rather than previous hard-coded
diff --git a/TODO b/TODO
index 42f83c3fa047d39938b70322d31db30e479e5c48..1181bdcd881e4476ecc1b442bfa457b3d25cb055 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ TESTS TO ADD
 * :db-constraint tests
 * test *db-auto-sync* 
 * for-each-row macro
-* universal-time 
 * owner phrases for postgresql and oracle backends
 * Number and Char field types
 
index cd754d8b34ea12bc6d669af4c077dcd1f4227f54..76fefe9875fb3aae6f25c907c0cc192db1baa29f 100644 (file)
@@ -3,7 +3,7 @@ cl-sql (2.11.2-1) unstable; urgency=low
   * New upstream
   * Add cl-sql-oracle binary package   
 
- -- Kevin M. Rosenberg <kmr@debian.org>  Wed, 26 May 2004 09:10:12 -0600
+ -- Kevin M. Rosenberg <kmr@debian.org>  Thu, 27 May 2004 04:47:27 -0600
 
 cl-sql (2.11.1-1) unstable; urgency=low
 
index ee4fc93f68cf399d75f0003a79caab190cdc7d33..856ffbe8048adf1c3609f7e5ed2eb0a1a1697157 100644 (file)
@@ -86,8 +86,7 @@ Depends: cl-sql (>= ${Source-Version}), cl-sql-uffi (>= ${Source-Version})
 Provides: cl-sql-backend
 Description: CLSQL database backend, Oracle
  This package enables you to use the CLSQL data access package
- with Oracle databases.  This package requires the Oracle Instant
- Client libraries to operate.
+ with Oracle databases.
  CLSQL is a Common Lisp interface to SQL databases.
 
 Package: cl-sql-tests
index ab533770543298a672918288e6b05eb10453fa30..8b1d0ef7b6b436c136f8850768442f16efaeb0e0 100644 (file)
        (read-from-string val)))
     (number val)))
 
-(defmethod read-sql-value (val (type (eql 'univeral-time)) database db-type)
+(defmethod read-sql-value (val (type (eql 'universal-time)) database db-type)
   (declare (ignore database db-type))
   (unless (eq 'NULL val)
     (etypecase val
index 0ffe57e376db795686ba33e85fc1755a0ec03703..b75f2cf2dbdc6ceb60ca2d091ed3dd8c65623c14 100644 (file)
@@ -86,7 +86,7 @@
                     (clsql:list-attributes [employee]
                                           :owner *test-database-user*))
             #'string<))
-  "birthday" "ecompanyid" "email" "emplid" "first_name" "groupid" "height"
+  "bd_utime" "birthday" "ecompanyid" "email" "emplid" "first_name" "groupid" "height"
   "last_name" "managerid" "married")
 
 (deftest :fddl/attributes/2
@@ -96,7 +96,7 @@
                     (clsql:list-attribute-types [employee]
                                                :owner *test-database-user*))
             #'string<))
-  "birthday" "ecompanyid" "email" "emplid" "first_name" "groupid" "height"
+  "bd_utime" "birthday" "ecompanyid" "email" "emplid" "first_name" "groupid" "height"
   "last_name" "managerid" "married")
 
 ;; Attribute types are vendor specific so need to test a range
     (and (member (clsql:attribute-type [height] [employee]) '(:float :float8 :number)) t)
   t)
 
+(deftest :fddl/attributes/7
+    (and (member (clsql:attribute-type [bd_utime] [employee]) '(:bigint :int8 :number)) t)
+  t)
 
 
 ;; create a view, test for existence, drop it and test again
index a3228ab189707b62e162f451ae762785950d68b8..eac258f278200a4f5db41fc19428c5655a97dbc7 100644 (file)
        
 ;; inserts a record using all values only and then deletes it 
 (deftest :fdml/insert/1
-    (progn
+    (let ((now (get-universal-time)))
       (clsql:insert-records :into [employee] 
-                           :values `(11 1 "Yuri" "Gagarin" "gagarin@soviet.org"
-                                     1 1 1.85 t ,(clsql:get-time)))
+       :values `(11 1 "Yuri" "Gagarin" "gagarin@soviet.org"
+                   1 1 1.85 t ,(clsql:utime->time now) ,now))
       (values 
        (clsql:select [first-name] [last-name] [email]
                     :from [employee] :where [= [emplid] 11])
index 415af2a2b81a3c5f9b562de889f47c20a21411e5..489b50b280ca53cfe79f2d9be30a8e81f4c5b709 100644 (file)
@@ -30,6 +30,7 @@
 (defvar *test-database-type* nil)
 (defvar *test-database-underlying-type* nil)
 (defvar *test-database-user* nil)
+(defvar *test-start-utime* nil)
 
 (defclass thing ()
   ((extraterrestrial :initform nil :initarg :extraterrestrial)))
@@ -40,6 +41,7 @@
    (married :db-kind :base :accessor married :type boolean
             :initarg :married)
    (birthday :type clsql:wall-time :initarg :birthday)
+   (bd-utime :type clsql:universal-time :initarg :bd-utime)
    (hobby :db-kind :virtual :initarg :hobby :initform nil)))
   
 (def-view-class employee (person)
     (clsql:create-view-from-class 'employee-address)
     (clsql:create-view-from-class 'big))
 
-  (let ((*db-auto-sync* t))
+  (setq *test-start-utime* (get-universal-time))
+  (let* ((*db-auto-sync* t)
+        (now-time (clsql:utime->time *test-start-utime*)))
     (setf company1 (make-instance 'company
                                  :presidentid 1
                                  :companyid 1
                                   :groupid 1
                                   :married t 
                                   :height (1+ (random 1.00))
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Vladamir"
                                   :last-name "Lenin"
                                   :email "lenin@soviet.org"
                                   :groupid 1
                                   :height (1+ (random 1.00))
                                   :married t 
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Josef"
                                   :last-name "Stalin"
                                   :email "stalin@soviet.org"
                                   :groupid 1
                                   :height (1+ (random 1.00))
                                   :married t 
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Leon"
                                   :last-name "Trotsky"
                                   :email "trotsky@soviet.org"
                                   :groupid 1
                                   :height (1+ (random 1.00))
                                   :married nil
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Nikita"
                                   :last-name "Kruschev"
                                   :email "kruschev@soviet.org"
                                   :groupid 1
                                   :married nil
                                   :height (1+ (random 1.00))
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Leonid"
                                   :last-name "Brezhnev"
                                   :email "brezhnev@soviet.org"
                                   :groupid 1
                                   :married nil
                                   :height (1+ (random 1.00))
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Yuri"
                                   :last-name "Andropov"
                                   :email "andropov@soviet.org"
                                   :groupid 1
                                   :height (1+ (random 1.00))
                                   :married nil
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Konstantin"
                                   :last-name "Chernenko"
                                   :email "chernenko@soviet.org"
                                   :groupid 1
                                   :height (1+ (random 1.00))
                                   :married nil
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Mikhail"
                                   :last-name "Gorbachev"
                                   :email "gorbachev@soviet.org"
                                   :groupid 1 
                                   :married nil
                                   :height (1+ (random 1.00))
-                                  :birthday (clsql:get-time)
+                                  :bd-utime *test-start-utime*
+                                  :birthday now-time
                                   :first-name "Boris"
                                   :last-name "Yeltsin"
                                   :email "yeltsin@soviet.org"
                                    :groupid 1
                                    :married nil
                                    :height (1+ (random 1.00))
-                                   :birthday (clsql:get-time)
+                                   :bd-utime *test-start-utime*
+                                   :birthday now-time
                                    :first-name "Vladamir"
                                    :last-name "Putin"
                                    :email "putin@soviet.org"
index 0339179ba145f977e4f817d51acab6af273f80bb..d2b73f48278208f4feafab93c0697ebb9ae5ae1d 100644 (file)
       fail-index)
   -1)
 
+(deftest :ooddl/time/3
+    (progn
+      (when (member *test-database-underlying-type* '(:postgresql :postgresql-socket))
+       (clsql:execute-command "set datestyle to 'iso'"))
+      (let ((dbobj (car (clsql:select 'employee :where [= [emplid] 10]
+                                     :flatp t))))
+       (list
+        (eql *test-start-utime* (slot-value dbobj 'bd-utime))
+        (clsql:time= (slot-value dbobj 'birthday)
+                     (clsql:utime->time (slot-value dbobj 'bd-utime))))))
+  (t t))
+
 ))
 
 #.(clsql:restore-sql-reader-syntax-state)