Name

UPDATE-INSTANCE-FROM-RECORDS — Update slot values from database.Function

Syntax

      update-instance-from-records object &key database => object

Arguments and Values

object

An instance of a View Class.

database

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

Description

Updates the slot values 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-instance-from-records *e1*)
=> #<EMPLOYEE {4806B53D}>
(slot-value *e1* 'email)
=> "v.lenin@soviet.org"
      

Side Effects

Slot values of object may be modified.

Affected by

Data in SQL database.

Exceptional Situations

If database is not able to be read.

See Also

update-slot-from-record
update-objects-joins

Notes

None.