public class ExecuteUpdateWork extends java.lang.Object implements ReturningWork<java.lang.Integer>
setParameters(PreparedStatement)
method it is possible to set parameters on the prepared statement before
the SQL is executed.PreparedStatement.executeUpdate()
Modifier and Type | Field and Description |
---|---|
private SessionControl |
sc |
private java.lang.String |
sql |
Constructor and Description |
---|
ExecuteUpdateWork(SessionControl sc,
java.lang.String sql)
Create a new work item.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
execute(java.sql.Connection connection)
From the Work interface
-----------------------
|
protected void |
setParameters(java.sql.PreparedStatement ps)
This method should be overridden by subclasses that needs to
set parameters on the statement that is going to be executed.
|
private SessionControl sc
private java.lang.String sql
public ExecuteUpdateWork(SessionControl sc, java.lang.String sql)
sc
- The session control to keep alive during the execution
of the sql, or nullsql
- The sql to executepublic java.lang.Integer execute(java.sql.Connection connection) throws java.sql.SQLException
execute
in interface ReturningWork<java.lang.Integer>
java.sql.SQLException
protected void setParameters(java.sql.PreparedStatement ps) throws java.sql.SQLException
Connection.prepareStatement(String)
and before it is executed
with PreparedStatement.executeUpdate()
.ps
- The prepared statementjava.sql.SQLException