The function
query
is the basic SQL query function. It queries the database specified by
database
with an SQL query statement given by
query-expression
.
The argument database defaults to *default-database*.
result-types
is a list of symbols such as
:string
and
:integer
, one for each field in the query, which are used to specify the types to return.
flatp is used as in select.
result-list is a list of values as per select, and field-names is a list of field names selected in sql-exp .
The following two queries, on a table whose second column contains dates that we want to return as strings, are equivalent:
(sql:query "select * from some_table"
:result-types '(nil :string))
(sql:query [select [*]
:from [some_table]
:result-types '(nil :string)])