[#1051] Add Factory.execute(String, Object...) as a convenience method for Factory.query(...).execute();
This commit is contained in:
parent
a0266fe617
commit
fe5bdc9749
@ -381,6 +381,16 @@ public class FactoryProxy implements FactoryOperations, MethodInterceptor {
|
||||
return getDelegate().fetchOne(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int execute(String sql) throws DataAccessException {
|
||||
return getDelegate().execute(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int execute(String sql, Object... bindings) throws DataAccessException {
|
||||
return getDelegate().execute(sql, bindings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ResultQuery<Record> resultQuery(String sql) throws DataAccessException {
|
||||
return getDelegate().resultQuery(sql);
|
||||
|
||||
@ -1034,6 +1034,39 @@ public interface FactoryOperations extends Configuration {
|
||||
@Support
|
||||
Record fetchOne(String sql, Object... bindings) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Execute a query holding plain SQL.
|
||||
* <p>
|
||||
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
|
||||
* guarantee syntax integrity. You may also create the possibility of
|
||||
* malicious SQL injection. Be sure to properly use bind variables and/or
|
||||
* escape literals when concatenated into SQL clauses!
|
||||
*
|
||||
* @param sql The SQL
|
||||
* @return The results from the executed query
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@Support
|
||||
int execute(String sql) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Execute a new query holding plain SQL. There must be as many binding
|
||||
* variables contained in the SQL, as passed in the bindings parameter
|
||||
* <p>
|
||||
* <p>
|
||||
* <b>NOTE</b>: When inserting plain SQL into jOOQ objects, you must
|
||||
* guarantee syntax integrity. You may also create the possibility of
|
||||
* malicious SQL injection. Be sure to properly use bind variables and/or
|
||||
* escape literals when concatenated into SQL clauses!
|
||||
*
|
||||
* @param sql The SQL
|
||||
* @param bindings The bindings
|
||||
* @return The results from the executed query
|
||||
* @throws DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
@Support
|
||||
int execute(String sql, Object... bindings) throws DataAccessException;
|
||||
|
||||
/**
|
||||
* Create a new query holding plain SQL. There must not be any binding
|
||||
* variables contained in the SQL
|
||||
|
||||
@ -841,6 +841,22 @@ public class Factory implements FactoryOperations {
|
||||
return new SQLResultQuery(this, sql, bindings).fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final int execute(String sql) throws DataAccessException {
|
||||
return query(sql).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final int execute(String sql, Object... bindings) throws DataAccessException {
|
||||
return query(sql, bindings).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user