Commit 957330ac authored by ryszard.szopa's avatar ryszard.szopa
Browse files

Submarine signals an error when you try to create a DAO providing a non-existant ID.

darcs-hash:d1e454e619823d1be6947ca75b098c323e6ead38
parent 7a456cae
...@@ -80,6 +80,11 @@ any)." ...@@ -80,6 +80,11 @@ any)."
(:select '* (:select '*
:from (class-name-of dao) :from (class-name-of dao)
:where (:= 'id (get-id dao))) :alist))) :where (:= 'id (get-id dao))) :alist)))
(unless query-result
(error (make-condition
'sql-id-does-not-exist
:format-control "You tried to create a DAO with a non-existant ID."
:id (get-id dao) :table (class-name-of dao))))
(iter (iter
(for slot in (non-transient-slots-of dao)) (for slot in (non-transient-slots-of dao))
......
...@@ -99,6 +99,11 @@ right name in the table, but its type is wrong")) ...@@ -99,6 +99,11 @@ right name in the table, but its type is wrong"))
(type :initarg :type :reader column-type)) (type :initarg :type :reader column-type))
(:documentation "Condition signaling a missing column in an existing table.")) (:documentation "Condition signaling a missing column in an existing table."))
(define-condition sql-id-does-not-exist (sql-error)
((id :initarg :id :reader id))
(:documentation "Condition signaling the attempt to initialize a dao
with a non-existant ID."))
(defgeneric database-consistent-with-specification (class) (defgeneric database-consistent-with-specification (class)
(:documentation "Return nothing if TABLE in the connected-p database (:documentation "Return nothing if TABLE in the connected-p database
meets its specification. Otherwise, throw an appropriate error. There meets its specification. Otherwise, throw an appropriate error. There
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment