Has any consideration been given to adding batch update capability?  For
instance, the following method could be added to the QueryRunner class:

/**
 * Execute a batch of SQL INSERT, UPDATE, or DELETE queries.
 * 
 * @param conn The connection to use to run the query.
 * @param sql The SQL to execute.
 * @param params An array of query replacement parameters.
 * @return The number of rows updated per statement.
 * @throws SQLException
 */
public int[] batchUpdate(Connection conn, String sql, Object[][] params)
        throws SQLException {
        PreparedStatement stmt = null;
        int[] rows = null;
        try {
                stmt = this.prepareStatement(conn, sql);
                
                for(int i = 0; i < params.length; i++) {
                        this.fillStatement(stmt, params[i]);
                        stmt.addBatch();
                }
                rows = stmt.executeBatch();
        } catch (SQLException e) {
                this.rethrow(e, sql, params);
        } finally {
                DbUtils.close(stmt);
        }
        return rows;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to