A database table.
A list of values or a query expression.
A list of attributes.
A list of two-element lists.
A database.
The function insert-records
inserts values for attributes (or av-pairs ) into the table into . The argument values may be a list of values or a query expression. If attributes is supplied then values must be a corresponding list of values for each of the listed attribute names.
In the first example, the LispWorks expression
(insert-records :into [person]
:values '("abc" "Joe" "Bloggs" 10000 3000 nil
"plumber"))
is equivalent to the following SQL:
INSERT INTO PERSON
VALUES ('abc','Joe',
'Bloggs',10000,3000,NULL,'plumber')
In the second example, the LispWorks expression
(insert-records :into [person]
:attributes '(person_id income surname occupation)
:values '("aaa" 10 "jim" "plumb"))
is equivalent to the following SQL:
INSERT INTO PERSON
(PERSON_ID,INCOME,SURNAME,OCCUPATION)
VALUES ('aaa',10,'jim','plumb')
The following example demonstrates how to use :av-pairs
.
(insert-records :into [person] :av-pairs
'((person_id "bbb") (surname "Jones")))