/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing * @param columnNames an array of the names of the columns that should be * returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs * * @since 1.4 */ public int executeUpdate(String sql, String columnNames[]) throws SQLException { if (columnNames == null || columnNames.length == 0) return executeUpdate(sql); sql = addReturning(connection, sql, columnNames, true); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver with the * given flag about whether the * auto-generated keys produced by this <code>Statement</code> object * should be made available for retrieval. * * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that * returns nothing * @param autoGeneratedKeys a flag indicating whether auto-generated keys * should be made available for retrieval; * one of the following constants: * <code>Statement.RETURN_GENERATED_KEYS</code> * <code>Statement.NO_GENERATED_KEYS</code> * @return either the row count for <code>INSERT</code>, <code>UPDATE</code> * or <code>DELETE</code> statements, or <code>0</code> for SQL * statements that return nothing * @exception SQLException if a database access error occurs, the given * SQL statement returns a <code>ResultSet</code> object, or * the given constant is not one of those allowed * @since 1.4 */ public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { if (autoGeneratedKeys == Statement.NO_GENERATED_KEYS) return executeUpdate(sql); sql = addReturning(connection, sql, new String[]{"*"}, false); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing, * such as an SQL DDL statement * @param columnIndexes an array of column indexes indicating the columns * that should be returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs or the SQL * statement returns a <code>ResultSet</code> object * @since 1.4 */ public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { if (columnIndexes == null || columnIndexes.length == 0) return executeUpdate(sql); throw new PSQLException(GT.tr("Returning autogenerated keys by column index is not supported."), PSQLState.NOT_IMPLEMENTED); }
/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing * @param columnNames an array of the names of the columns that should be * returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs * * @since 1.4 */ public int executeUpdate(String sql, String columnNames[]) throws SQLException { if (columnNames == null || columnNames.length == 0) return executeUpdate(sql); sql = addReturning(connection, sql, columnNames, true); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing * @param columnNames an array of the names of the columns that should be * returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs * * @since 1.4 */ public int executeUpdate(String sql, String columnNames[]) throws SQLException { if (columnNames == null || columnNames.length == 0) return executeUpdate(sql); sql = addReturning(connection, sql, columnNames, true); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver with the * given flag about whether the * auto-generated keys produced by this <code>Statement</code> object * should be made available for retrieval. * * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that * returns nothing * @param autoGeneratedKeys a flag indicating whether auto-generated keys * should be made available for retrieval; * one of the following constants: * <code>Statement.RETURN_GENERATED_KEYS</code> * <code>Statement.NO_GENERATED_KEYS</code> * @return either the row count for <code>INSERT</code>, <code>UPDATE</code> * or <code>DELETE</code> statements, or <code>0</code> for SQL * statements that return nothing * @exception SQLException if a database access error occurs, the given * SQL statement returns a <code>ResultSet</code> object, or * the given constant is not one of those allowed * @since 1.4 */ public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { if (autoGeneratedKeys == Statement.NO_GENERATED_KEYS) return executeUpdate(sql); sql = addReturning(connection, sql, new String[]{"*"}, false); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver with the * given flag about whether the * auto-generated keys produced by this <code>Statement</code> object * should be made available for retrieval. * * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that * returns nothing * @param autoGeneratedKeys a flag indicating whether auto-generated keys * should be made available for retrieval; * one of the following constants: * <code>Statement.RETURN_GENERATED_KEYS</code> * <code>Statement.NO_GENERATED_KEYS</code> * @return either the row count for <code>INSERT</code>, <code>UPDATE</code> * or <code>DELETE</code> statements, or <code>0</code> for SQL * statements that return nothing * @exception SQLException if a database access error occurs, the given * SQL statement returns a <code>ResultSet</code> object, or * the given constant is not one of those allowed * @since 1.4 */ public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { if (autoGeneratedKeys == Statement.NO_GENERATED_KEYS) return executeUpdate(sql); sql = addReturning(connection, sql, new String[]{"*"}, false); wantsGeneratedKeysOnce = true; return executeUpdate(sql); }
/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing, * such as an SQL DDL statement * @param columnIndexes an array of column indexes indicating the columns * that should be returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs or the SQL * statement returns a <code>ResultSet</code> object * @since 1.4 */ public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { if (columnIndexes == null || columnIndexes.length == 0) return executeUpdate(sql); throw new PSQLException(GT.tr("Returning autogenerated keys by column index is not supported."), PSQLState.NOT_IMPLEMENTED); }
/** * Executes the given SQL statement and signals the driver that the * auto-generated keys indicated in the given array should be made available * for retrieval. The driver will ignore the array if the SQL statement * is not an <code>INSERT</code> statement. * * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code> statement or an SQL statement that returns nothing, * such as an SQL DDL statement * @param columnIndexes an array of column indexes indicating the columns * that should be returned from the inserted row * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, * or <code>DELETE</code> statements, or 0 for SQL statements * that return nothing * @exception SQLException if a database access error occurs or the SQL * statement returns a <code>ResultSet</code> object * @since 1.4 */ public int executeUpdate(String sql, int columnIndexes[]) throws SQLException { if (columnIndexes == null || columnIndexes.length == 0) return executeUpdate(sql); throw new PSQLException(GT.tr("Returning autogenerated keys by column index is not supported."), PSQLState.NOT_IMPLEMENTED); }