From 2b3fb59dbef9ce389acbcc6bdba973a81ce2149f Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 15 Feb 2013 18:17:00 +0100 Subject: [PATCH] [#2204] Add BatchBindStep.bind(Object[][]) to bind lots of bind values at a time --- jOOQ/src/main/java/org/jooq/BatchBindStep.java | 15 +++++++++------ jOOQ/src/main/java/org/jooq/impl/BatchSingle.java | 9 +++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/BatchBindStep.java b/jOOQ/src/main/java/org/jooq/BatchBindStep.java index 54991cfdc1..9d4c81c203 100644 --- a/jOOQ/src/main/java/org/jooq/BatchBindStep.java +++ b/jOOQ/src/main/java/org/jooq/BatchBindStep.java @@ -37,8 +37,6 @@ package org.jooq; import java.sql.Statement; -import org.jooq.exception.DataAccessException; - /** * This type is used for the {@link Batch}'s DSL API. *

@@ -51,9 +49,14 @@ import org.jooq.exception.DataAccessException; public interface BatchBindStep extends Batch { /** - * Set bind values on the batch statement - * - * @throws DataAccessException if something went wrong executing the query + * Set bind values on the batch statement. */ - BatchBindStep bind(Object... bindValues) throws DataAccessException; + BatchBindStep bind(Object... bindValues); + + /** + * Set several bind values on the batch statement. + *

+ * This is the same as calling {@link #bind(Object...)} several times. + */ + BatchBindStep bind(Object[][] bindValues); } diff --git a/jOOQ/src/main/java/org/jooq/impl/BatchSingle.java b/jOOQ/src/main/java/org/jooq/impl/BatchSingle.java index a024255a6e..db789d0e83 100644 --- a/jOOQ/src/main/java/org/jooq/impl/BatchSingle.java +++ b/jOOQ/src/main/java/org/jooq/impl/BatchSingle.java @@ -74,6 +74,15 @@ class BatchSingle implements BatchBindStep { return this; } + @Override + public final BatchSingle bind(Object[][] bindValues) { + for (Object[] v : bindValues) { + bind(v); + } + + return this; + } + @Override public final int size() { return allBindValues.size();