From: Kevin M. Rosenberg Date: Thu, 27 May 2004 10:49:50 +0000 (+0000) Subject: r9485: 26 May 2004 Kevin Rosenberg X-Git-Tag: v3.8.6~368 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=7c7edf1d85706148f55a8507a261d024defa0c7c r9485: 26 May 2004 Kevin Rosenberg * 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 --- diff --git a/ChangeLog b/ChangeLog index be86ce1..69b6f6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +26 May 2004 Kevin Rosenberg + * 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 * 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 42f83c3..1181bdc 100644 --- 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 diff --git a/debian/changelog b/debian/changelog index cd754d8..76fefe9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,7 @@ cl-sql (2.11.2-1) unstable; urgency=low * New upstream * Add cl-sql-oracle binary package - -- Kevin M. Rosenberg Wed, 26 May 2004 09:10:12 -0600 + -- Kevin M. Rosenberg Thu, 27 May 2004 04:47:27 -0600 cl-sql (2.11.1-1) unstable; urgency=low diff --git a/debian/control b/debian/control index ee4fc93..856ffbe 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/sql/oodml.lisp b/sql/oodml.lisp index ab53377..8b1d0ef 100644 --- a/sql/oodml.lisp +++ b/sql/oodml.lisp @@ -524,7 +524,7 @@ (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 diff --git a/tests/test-fddl.lisp b/tests/test-fddl.lisp index 0ffe57e..b75f2cf 100644 --- a/tests/test-fddl.lisp +++ b/tests/test-fddl.lisp @@ -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 @@ -118,6 +118,9 @@ (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 diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index a3228ab..eac258f 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -24,10 +24,10 @@ ;; 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]) diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 415af2a..489b50b 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -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) @@ -236,7 +238,9 @@ (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 @@ -247,7 +251,8 @@ :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" @@ -257,7 +262,8 @@ :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" @@ -268,7 +274,8 @@ :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" @@ -279,7 +286,8 @@ :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" @@ -290,7 +298,8 @@ :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" @@ -301,7 +310,8 @@ :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" @@ -312,7 +322,8 @@ :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" @@ -323,7 +334,8 @@ :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" @@ -334,7 +346,8 @@ :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" @@ -345,7 +358,8 @@ :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" diff --git a/tests/test-ooddl.lisp b/tests/test-ooddl.lisp index 0339179..d2b73f4 100644 --- a/tests/test-ooddl.lisp +++ b/tests/test-ooddl.lisp @@ -89,6 +89,18 @@ 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)