Name

UPDATE-SLOT-FROM-RECORD — Update objects slot from database.Function

Syntax

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

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 slot value, specified by the CLOS slot name slot, of the View Class instance object using the attribute values of the appropriate table of database which defaults to the database associated with object or, if object is not associated with a database, *default-database*. Join slots are updated but instances of the class on which the join is made are not updated.

Examples

(defvar *e1* (car (select 'employee :where [= [slot-value 'employee 'emplid] 1] :flatp t)))
=> *E1* 
(slot-value *e1* 'email)
=> "lenin@soviet.org"
(update-records [employee] 
                :av-pairs '(([email] "v.lenin@soviet.org"))
                :where [= [emplid] 1])
=> 
(update-slot-from-record *e1* 'email)
=> #<EMPLOYEE {4806B53D}>
(slot-value *e1* 'email)
=> "v.lenin@soviet.org"
      

Side Effects

Modifies the slot value of the object.

Affected by

Data in SQL database.

Exceptional Situations

Database errors.

See Also

update-instance-from-records
update-objects-joins

Notes

None.