Java SQL PreparedStatement setValues(PreparedStatement statement, Object... values)

Here you can find the source of setValues(PreparedStatement statement, Object... values)

Description

Set the given parameter values in the given PreparedStatement.

License

Apache License

Parameter

Parameter Description
statement a parameter
values The parameter values to be set in the created PreparedStatement.

Exception

Parameter Description
SQLException If something fails during setting thePreparedStatement values.

Declaration

public static void setValues(PreparedStatement statement, Object... values) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Main {
    /**/*from  w  w w  . ja va2s  .co m*/
     * Set the given parameter values in the given PreparedStatement.
     *
     * @param statement
     * @param values The parameter values to be set in the created
     * PreparedStatement.
     * @throws SQLException If something fails during setting the
     * PreparedStatement values.
     */
    public static void setValues(PreparedStatement statement, Object... values) throws SQLException {
        for (int i = 0; i < values.length; i++) {
            statement.setObject(i + 1, values[i]);
        }
    }
}

Related

  1. setBytes(PreparedStatement pstmt, int index, byte[] bytes)
  2. setValue(PreparedStatement ps, int paramIndex, Object inValue)
  3. setValue(PreparedStatement ps, int posicion, int tipo, String strDefault, String strValor)
  4. setValueIndex(PreparedStatement stmt, int index, int valueIndex)
  5. setValues(PreparedStatement preparedStatement, Object... values)
  6. setValues(PreparedStatement statement, Object... values)
  7. setValues(PreparedStatement statement, Object[] values)
  8. substitute(PreparedStatement stmt, Object[] params)
  9. writeArray(Connection connection, PreparedStatement preparedStatement, int column, Class type, T[] array)