Name
DELETE-INSTANCE-RECORDS — Delete SQL records represented by a View Class
object.
Function
Syntax
delete-instance-records
object
=>
Description
Deletes the records represented by
object
in the appropriate table of the
database associated with object
. If
object
is not yet associated with a
database, an error is signalled.
Examples
(def-view-class tab ()
((a :initarg :a :type integer :db-kind :key)
(b :initarg :b :type string)))
=> #<Standard-Db-Class TAB {49B01845}>
(create-view-from-class 'tab)
=>
(defvar obj (let ((*db-auto-sync* t))
(make-instance 'tab :a 5 :b "the string")))
=> OBJ
(start-sql-recording :type :both)
=>
(delete-instance-records obj)
;; 2004-07-17 11:07:19 foo/bar/baz => DELETE FROM tab WHERE tab.a = 5
;; 2004-07-17 11:07:19 foo/bar/baz <= T
=>
Side Effects
Deletes data from the SQL database.
Affected by
Permissions granted by the SQL database to the user in the
database connection.
Exceptional Situations
An exception may be signaled if the database connection user
does not have sufficient privileges to modify the database. An
error of type sql-database-error is signalled if
object
is not associated with an
active database.
Notes
Instances are referenced in the database by values stored in
the key slots. If
delete-records-from-instance
is called
with an instance of a class that does not contain any keys,
then all records in that table will be deleted.