Name

UPDATE-RECORD-FROM-SLOT — Updates database from slot value.Function

Syntax

      update-record-from-slot object slot &key database => 

Arguments and Values

object

An instance of a View Class.

slot

The name of a slot in object.

database

A database object. This will default to the value of *default-database*.

Description

Updates the value stored in the column represented by the slot, specified by the CLOS slot name slot, 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 database and the attribute represented by slot is initialised from the value of the supplied slots with other attributes having default values. Furthermore, object becomes associated with database.

Examples

(select [email] :from [employee] :where [= [emplid] 1] :field-names nil :flatp t)
=> ("lenin@soviet.org")
(defvar *e1* (car (select 'employee :where [= [slot-value 'employee 'emplid] 1] :flatp t)))
=> *E1* 
(slot-value *e1* 'email)
=> "lenin@soviet.org"
(setf (slot-value *e1* 'email) "v.lenin@soviet.org")
=> "v.lenin@soviet.org"
(update-record-from-slot *e1* 'email)
=> 
(select [email] :from [employee] :where [= [emplid] 1] :field-names nil :flatp t)
=> ("v.lenin@soviet.org")
      

Side Effects

Modifies database.

Affected By

Nothing.

Exceptional Situations

Database errors.

See Also

update-record-from-slots
update-records-from-instance

Notes

None.