UPDATE-RECORD-FROM-SLOTS — Update database from slots of view class object.function
objectAn instance of a View Class.
slots
A list of slot names in object.
databaseA database object. This will default to the value of *default-database*.
Updates the values stored in the columns represented by
the slots, specified by the clos slot names
slots, of View Class instance
object. database
specifies the database in which the update is made only if
object is not associated with a
database. In this case, a record is created in the appropriate
table of database and the attributes
represented by slots are initialised from
the values of the supplied slots with other attributes having
default values. Furthermore, object
becomes associated with database.
(select [last-name] [email] :from [employee] :where [= [emplid] 1] :field-names nil)
=> (("Lenin" "lenin@soviet.org"))
(defvar *e1* (car (select 'employee :where [= [slot-value 'employee 'emplid] 1] :flatp t)))
=> *E1*
(slot-value *e1* 'last-name)
=> "Lenin"
(slot-value *e1* 'email)
=> "lenin@soviet.org"
(setf (slot-value *e1* 'last-name) "Ivanovich")
=> "Ivanovich"
(setf (slot-value *e1* 'email) "v.ivanovich@soviet.org")
=> "v.ivanovich@soviet.org"
(update-record-from-slots *e1* '(email last-name))
=>
(select [last-name] [email] :from [employee] :where [= [emplid] 1] :field-names nil)
=> (("Ivanovich" "v.ivanovich@soviet.org"))