Back
insert-multi! (clj)
(source)function
(insert-multi! connectable table hash-maps)
(insert-multi! connectable table hash-maps opts)
(insert-multi! connectable table cols rows)
(insert-multi! connectable table cols rows opts)
Syntactic sugar over `execute!` or `execute-batch!` to make inserting
columns/rows easier.
Given a connectable object, a table name, a sequence of column names, and
a vector of rows of data (vectors of column values), inserts the data as
multiple rows in the database and attempts to return a vector of maps of
generated keys.
Given a connectable object, a table name, a sequence of hash maps of data,
which all have the same set of keys, inserts the data as multiple rows in
the database and attempts to return a vector of maps of generated keys.
If called with `:batch` true will call `execute-batch!` - see its documentation
for situations in which the generated keys may or may not be returned as well as
additional options that can be passed.
Note: without `:batch` this expands to a single SQL statement with placeholders for
every value being inserted -- for large sets of rows, this may exceed the limits
on SQL string size and/or number of parameters for your JDBC driver or your
database!