187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
-
+
-
+
-
+
-
-
+
+
+
|
already holds an active connection, it will be @racket[disconnect]ed and then replaced with the new
connection.
@defproc[(query! [query-statement statement?] [parameters any/c] ...) void?]
Executes a SQL statement using the current connection.
@defproc*[([(select-rows! [query statement?] [fieldnames (listof stringish?)]) hash?]
@defproc*[([(select-rows! [query statement?] [fieldnames (listof stringish?)]) (listof hash?)]
[(select-rows! [table stringish?] [fieldnames (listof stringish?)] [where-clause
stringish?]) hash?])]
stringish?]) (listof hash?)])]
Execute a SQL query that returns rows from the database, either using a raw query (first form
above), or using a table name, field names, and a @racket[_where-clause] (second form above).
Returns a hash table whose keys are the field names supplied.
Returns a list of hashes whose keys are the values supplied in @racket[_fieldnames].
In the first form, @racket[_fieldnames] should list all the fields that will be returned by the
query, in order, since this list will be used as the keys for the hash table result.
In the first form, @racket[_fieldnames] should list @emph{in order} all the fields that will be
returned by the query. If this isn’t done, the keys for each row’s hash will likely point to values
for the wrong fields.
|