1.2 Basic Queries and Query Results
1.2.1 Basic Queries
| |||
| |||
|
Queries the database and returns the query results.
Since a single SQL string may contain multiple SQL statements (delimited by semicolons), query* is the most general of the above procedures, as it will return one query-result for each SQL statement in the sql argument.
query returns only the query-result corresponding to the last SQL statement in sql, whereas query0 returns only the query-result corresponding to the first SQL statement in sql.
1.2.2 Query Results
A basic SQL query will return a value that satisfies query-result? (or a list of such values, if the query* procedure is used). Any such value will additionally satisfy either result-set? or side-effect?.
Returns #t if x represents the results of an SQL statement, #f otherwise.
1.2.2.1 Result Sets
Returns #t if x represents the results of an SQL statement that returns row data, #f otherwise.
Returns a list of rows, each of which is a vector.
Returns a vector containing the names of the result set’s fields, in order.
(in-result-set rs) → (sequence?) |
rs : result-set? |
Returns a sequence of rows, each of which is a vector.
(in-result-set/hash rs) → (sequence?) |
rs : result-set? |
Returns a sequence of rows, each of which is a hash table. The hash table’s keys are symbols representing the names of the result set’s fields, and the values are the row data.
1.2.2.2 Side Effects
Returns #t if x represents the results of an SQL statement that is evaluated for its side effects (e.g., an UPDATE or INSERT statement), #f otherwise.
(side-effect-affected-rows eff) → exact-nonnegative-integer? |
eff : side-effect? |
Returns the number of rows that were modified by the query that produced eff.
(side-effect-insert-id eff) → (or/c exact-positive-integer? #f) |
eff : side-effect? |
Returns the primary key that was automatically generated by the INSERT query that produced eff or #f if no such key was generated.
(side-effect-warning-count eff) → exact-nonnegative-integer? |
eff : side-effect? |
Returns the number of warnings generated by the query that produced eff.
Returns a status message generated by the query that produced eff or #f if no message was generated.