From 58aeff56f7aaeafbf2496655b8cdcfe60484fcc1 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Mon, 8 Jul 2019 17:21:28 -0700 Subject: [PATCH] Updated insert-multi! docstring Removed caveat about batching (doesn't apply) but added caveat about size/parameter limits. --- src/next/jdbc/sql.clj | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/next/jdbc/sql.clj b/src/next/jdbc/sql.clj index 2453ee4..71bbc40 100644 --- a/src/next/jdbc/sql.clj +++ b/src/next/jdbc/sql.clj @@ -192,10 +192,10 @@ multiple rows in the database and attempts to return a vector of maps of generated keys. - Note: some database drivers need to be told to rewrite the SQL for this to - be performed as a single, batched operation. In particular, PostgreSQL - requires the `:reWriteBatchedInserts true` option and MySQL requires - `:rewriteBatchedStatement true` (both non-standard JDBC options, of course!)." + Note: 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!" ([connectable table cols rows] (insert-multi! connectable table cols rows {})) ([connectable table cols rows opts] @@ -203,6 +203,15 @@ (for-insert-multi table cols rows opts) (merge {:return-keys true} opts)))) +(comment + ;; removed this caveat from insert-multi! because it doesn't apply -- + ;; these DB-specific options are only needed when you have batched + ;; parameters and the driver needs a "hint" to perform an actual batch op! + "Note: some database drivers need to be told to rewrite the SQL for this to + be performed as a single, batched operation. In particular, PostgreSQL + requires the `:reWriteBatchedInserts true` option and MySQL requires + `:rewriteBatchedStatement true` (both non-standard JDBC options, of course!).") + (defn query "Syntactic sugar over `execute!` to provide a query alias.