params-setter
accept connection
argument
(fn [sql-source pstmt params])
to (fn [conn sql-source pstmt params])
defrowrecord
or defrowmaker
:group-placeholder
, e.g. {:values "(?, ?, ?)"}
or {:values "(^int $foo, ^boolean $bar, $baz)"}
INSERT INTO emp (c1, c2) VALUES (v1, v2), (v3, v4), (v5, v6);
WHERE (foo, bar) IN ((10, 20), (30, 40), (50, 60))
IN (^multi (^int $foo, ^string $bar))
DataSource
instrumentationasphalt.type.ISqlSource/read-col
(supplant with read-row
)utc-date
, utc-time
, utc-timestamp
ResultSet.getObject(int, Class)
at allResultSet.getObject(int, Integer)
to ResultSet.getInt(int)
ResultSet.getObject(int, Class)
asphalt.core/compile-sql-template
(by extension, defsql
)
:params-setter
:row-maker
:column-reader
^sql
variable cannot set JDBC paramsSELECT foo FROM ^sql $table WHERE id = $id
defsql
with arity and metadata to make it behave more like defn
:arglists
metadata key (for better documentation and meta-programming support):doc
metadata key with value same as the specified SQL template(defsql foo docstring sql options)
asphalt.core
functions docstringasphalt.core/instrument-connection-source
:param-placeholder
option in defsql
for named multi-value parameters
IN (^objects $ids)
-> IN (UNHEX(?), UNHEX(?))
defsql
and parse-sql
with extra options
:param-types
:result-types
array
ascii-stream
big-decimal
binary-stream
blob
character-stream
clob
ncharacter-stream
nclob
ref
row-id
sql-xml
url
defsql
and compile-sql-template
:result-set-worker
(this has no corresponding factory fn):params-setter
:row-maker
:column-reader
:conn-worker
^object
instead of dynamic discovery
^nil
type hint^^
to imply default type hint (useful in hinting result columns)asphalt.core/defsql
clojure.lang.Named
interface, hence (name sql-source)
works:sql-name
option kwargIN (^ints $dept-ids)
clauses)
?
placeholderquery
vs update
based on first SQL token(f connection-source params)
using associated connection-workerasphalt.type.ISqlSource/get-sql
accepts params as argument (for dynamic SQL)asphalt.type.ISqlSource/read-col
no more accepts column-index argumentasphalt.param
namespace
lay-params
(available at macro-expansion time, efficient)set-params
(available at run time, flexible)java.util.Calendar
with timezoneset-params-with-query-timeout
moved from asphalt.core
to asphalt.param
asphalt.result
namespace
asphalt.result/letcol
(macro) with support for
asphalt.core/fetch-maps
asphalt.core
fetch fns (arity 3):column-index
option from fetch-value
asphalt.core/defquery
in favor of asphalt.core/defsql
behaving as functionfetch-optional-row
and fetch-optional-value
in asphalt.core
namespaceasphalt.core/query
(arity 3) is now asphalt.core/fetch-rows
asphalt.core/fetch-maps
to use provided row-makerasphalt.type.ISql
to asphalt.type.ISqlSource
(internal breaking change)asphalt.type.IConnectionSource
java.sql.Connection
and javax.sql.DataSource
(already supported)instrument-connection-source
for creating JDBC connections
instrument-datasource
asphalt.transaction
(breaking change)with-transaction
accepts an option map as second argument (breaking change):result-success?
, :error-failure?
, :isolation
, :propagation
asphalt.type.ITransactionPropagation
clojure.lang.ExceptionInfo
with meta datajavax.sql.DataSource
objectsdefquery
to bind SQL templates to intended operationsset-params-with-query-timeout
as set-params
replacementExceptionInfo
) for runtime errorsasphalt.type.ISql
SQLTemplate
out of the boxSQLTemplate
java.sql.ResultSet
java.sql.Connection
and javax.sql.DataSource
)Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close