From: Kevin M. Rosenberg Date: Mon, 3 May 2004 18:44:03 +0000 (+0000) Subject: r9212: Automated commit for Debian build of clsql upstream-version-2.10.8 X-Git-Tag: v3.8.6~543 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=ec9b352b8205e4204a06797f98970b03cf532ab2 r9212: Automated commit for Debian build of clsql upstream-version-2.10.8 --- diff --git a/ChangeLog b/ChangeLog index 5881d6d..1d20734 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,11 +5,13 @@ * db-postgresql-socket/postgresql-socket-sql.lisp: Honor value of *backend-warning-behavior* * tests/test-fdml.lisp: Remove test of raw boolean value - since different backends handle this differently. - * tests/test-oodml.lisp: Add test for boolean slot value + since different backends handle this differently. Add + test for :column attribute. + * tests/test-oodml.lisp: Add tests for boolean slot value + and for :void-value attribute * tests/test-init.lisp: Use *backend-warning-behavior* to suppress warnings from postgresql about implicitly - creating primary key in tables. + creating primary key in tables. Add new address table. 3 May 2004 Kevin Rosenberg (kevin@rosenberg.net) * Version 2.10.7 diff --git a/TODO b/TODO index b2a71d3..f3852b0 100644 --- a/TODO +++ b/TODO @@ -7,13 +7,11 @@ GENERAL TESTS TO ADD * CACHE-TABLE-QUERIES -* :VOID-VALUE attribute, use a new view-class with several fields with different void-values -* :COLUMN attribute * Test that ":db-kind :key" adds an index for that key. This is complicated by different backends showing autogenerated primary key in different ways. * Test New universal and bigint types, add tests for other types such as duration and money * Large object testing -* Test instance slot values when SELECT called for objects +* :db-constraint tests COMMONSQL SPEC diff --git a/base/conditions.lisp b/base/conditions.lisp index 4954ece..6b7d971 100644 --- a/base/conditions.lisp +++ b/base/conditions.lisp @@ -98,7 +98,7 @@ and signal an clsql-invalid-spec-error if they don't match." (define-condition clsql-sql-error (clsql-error) ((database :initarg :database :reader clsql-sql-error-database) - (message :initarg :message :initarg nil :reader clsql-sql-error-message) + (message :initarg :message :initform nil :reader clsql-sql-error-message) (expression :initarg :expression :initarg nil :reader clsql-sql-error-expression) (errno :initarg :errno :initarg nil :reader clsql-sql-error-errno) (error :initarg :error :initarg nil :reader clsql-sql-error-error)) diff --git a/debian/changelog b/debian/changelog index e3020e7..82217ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (2.10.8-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Mon, 3 May 2004 12:43:58 -0600 + cl-sql (2.10.7-1) unstable; urgency=low * New upstream diff --git a/sql/objects.lisp b/sql/objects.lisp index cb158d2..2d569c7 100644 --- a/sql/objects.lisp +++ b/sql/objects.lisp @@ -397,7 +397,7 @@ superclass of the newly-defined View Class." (let ((qualifier (key-qualifier-for-instance instance :database vd))) (delete-records :from vt :where qualifier :database vd) (setf (slot-value instance 'view-database) nil)) - (error 'clsql-no-database-error nil)))) + (error 'clsql-base::clsql-no-database-error :database nil)))) (defmethod update-instance-from-records ((instance standard-db-object) &key (database *default-database*)) @@ -795,7 +795,7 @@ superclass of the newly-defined View Class." objects)))) (let* ((*db-deserializing* t) (*default-database* (or database - (error 'clsql-no-database-error nil))) + (error 'clsql-base::clsql-no-database-error :database nil))) (sclasses (mapcar #'find-class view-classes)) (sels (mapcar #'generate-selection-list sclasses)) (fullsels (apply #'append sels)) diff --git a/tests/test-fddl.lisp b/tests/test-fddl.lisp index 0dc053b..4315f88 100644 --- a/tests/test-fddl.lisp +++ b/tests/test-fddl.lisp @@ -28,7 +28,7 @@ (sort (mapcar #'string-downcase (clsql:list-tables :owner *test-database-user*)) #'string<)) - "company" "employee" "type_table") + "address" "company" "employee" "type_table") ;; create a table, test for its existence, drop it and test again (deftest :fddl/table/2 diff --git a/tests/test-fdml.lisp b/tests/test-fdml.lisp index 53bc3fa..b74e532 100644 --- a/tests/test-fdml.lisp +++ b/tests/test-fdml.lisp @@ -287,6 +287,17 @@ :flatp t))) t) +(deftest :fdml/select/15 + (multiple-value-bind (rows field-names) + (clsql:select [emplid] [street-number] [street-name] [city_field] [zip] + :from [address] + :where [= 1 [emplid]]) + (values + rows + (mapcar #'string-downcase field-names))) + ((1 10 "Park Place" "Leningrad" 123)) + ("emplid" "street_number" "street_name" "city_field" "zip")) + ;(deftest :fdml/select/11 ; (clsql:select [emplid] :from [employee] ; :where [= [emplid] [any [select [companyid] :from [company]]]] diff --git a/tests/test-init.lisp b/tests/test-init.lisp index eef4f88..28ae587 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -117,6 +117,29 @@ (:base-table company)) +(def-view-class address () + ((emplid + :db-kind :key + :db-constraints :not-null + :type integer + :initarg :emplid) + (street-number + :type integer + :initarg :street-number) + (street-name + :type (string 30) + :void-value "" + :initarg :street-name) + (city + :column "city_field" + :void-value "no city" + :type (string 30) + :initarg :city) + (postal-code + :column "zip" + :type integer + :void-value 0 + :initarg :postal-code))) (defun test-connect-to-database (db-type spec) (when (db-backend-has-create/destroy-db? db-type) @@ -152,6 +175,8 @@ (defparameter employee8 nil) (defparameter employee9 nil) (defparameter employee10 nil) +(defparameter address1 nil) +(defparameter address2 nil) (defun test-initialise-database () (test-basic-initialize) @@ -161,7 +186,8 @@ :ignore :warn))) (clsql:create-view-from-class 'employee) - (clsql:create-view-from-class 'company)) + (clsql:create-view-from-class 'company) + (clsql:create-view-from-class 'address)) (setf company1 (make-instance 'company :companyid 1 @@ -258,7 +284,17 @@ :birthday (clsql-base:get-time) :first-name "Vladamir" :last-name "Putin" - :email "putin@soviet.org")) + :email "putin@soviet.org") + + address1 (make-instance 'address + :emplid 1 + :street-number 10 + :street-name "Park Place" + :city "Leningrad" + :postal-code 123) + + address2 (make-instance 'address + :emplid 2)) ;; sleep to ensure birthdays are no longer at current time (sleep 2) @@ -297,7 +333,9 @@ (clsql:update-records-from-instance employee8) (clsql:update-records-from-instance employee9) (clsql:update-records-from-instance employee10) - (clsql:update-records-from-instance company1)) + (clsql:update-records-from-instance company1) + (clsql:update-records-from-instance address1) + (clsql:update-records-from-instance address2)) (defvar *error-count* 0) (defvar *error-list* nil) diff --git a/tests/test-oodml.lisp b/tests/test-oodml.lisp index 7cac6fe..84046fc 100644 --- a/tests/test-oodml.lisp +++ b/tests/test-oodml.lisp @@ -66,6 +66,24 @@ (slot-value (caar (clsql:select 'employee :where [= 4 [emplid]])) 'married) nil) +(deftest :oodml/select/8 + (let ((a (caar (clsql:select 'address :where [= 1 [emplid]])))) + (values + (slot-value a 'street-number) + (slot-value a 'street-name) + (slot-value a 'city) + (slot-value a 'postal-code))) + 10 "Park Place" "Leningrad" 123) + +(deftest :oodml/select/9 + (let ((a (caar (clsql:select 'address :where [= 2 [emplid]])))) + (values + (slot-value a 'street-number) + (slot-value a 'street-name) + (slot-value a 'city) + (slot-value a 'postal-code))) + nil "" "no city" 0) + ;; tests update-records-from-instance (deftest :oodml/update-records/1 (values