(execute conn sql)
(execute conn sql params)
Executes a SQL statement on the provided JDBC connection. If the statement is a query, the return value of this function is a vector of row maps in a format described below. If the statement is an update, the update count (an integer) is returned. If the SQL contains more than one statement, a vector of results is returned.
The maps created from rows use the column labels as generated by the SQL statement. The column labels are converted to keywords following clojure conventions: they are made lower-case, hypens are replaced by underscores, and duplicates have a number appended. Duplicates can (and probably should) be avoided by using the SQL 'AS' keyword to provide a label. Thus, a select in the form:
SELECT A.x, A.y_z, B.x, C.x as c_x FROM ...
Will have result rows in the form:
{:x ..., :y-z ..., :x-2 ..., :c_x ...}
[conn sql] When only connection and a SQL string are supplied, the statement is executed via Statement/execute.
[conn sql params] When additional parameters collection is supplied, the parameters are bound in order to a PreparedStatement using .setObject.
Executes a SQL statement on the provided JDBC connection. If the statement is a query, the return value of this function is a vector of row maps in a format described below. If the statement is an update, the update count (an integer) is returned. If the SQL contains more than one statement, a vector of results is returned. The maps created from rows use the column labels as generated by the SQL statement. The column labels are converted to keywords following clojure conventions: they are made lower-case, hypens are replaced by underscores, and duplicates have a number appended. Duplicates can (and probably should) be avoided by using the SQL 'AS' keyword to provide a label. Thus, a select in the form: SELECT A.x, A.y_z, B.x, C.x as c_x FROM ... Will have result rows in the form: {:x ..., :y-z ..., :x-2 ..., :c_x ...} [conn sql] When only connection and a SQL string are supplied, the statement is executed via Statement/execute. [conn sql params] When additional parameters collection is supplied, the parameters are bound in order to a PreparedStatement using .setObject.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close