|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pf.db.util.SQLExecutor
public class SQLExecutor
Provides an easy to use interface to execute SQL statements against a database.
Constructor Summary | |
---|---|
SQLExecutor(DataSource aDataSource)
Initialize the new instance with default values. |
Method Summary | |
---|---|
void |
close()
Closes all open connections. |
void |
closeStatement(Statement statement)
Closes the given statement. |
int |
execute(String sql)
Executes the given SQL command and returns the number of affected rows. |
boolean |
executeSQL(String sql)
Executes the given SQL command and returns true if the execution was successful. |
int |
executeWriteStatement(PreparedStatement statement)
Executes the given statement and returns the number of affected rows. |
PreparedStatement |
prepareWriteStatement(String sql)
Returns a PreparedStatement for the given SQL command. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLExecutor(DataSource aDataSource)
aDataSource
- The datasource the executor should connect to (must not be null)Method Detail |
---|
public PreparedStatement prepareWriteStatement(String sql) throws SQLException
sql
- A valid SQL statement with placeholders (?) (no SELECT allowed here!)
SQLException
- Any problem that occurs during executionpublic int executeWriteStatement(PreparedStatement statement) throws SQLException
statement
- A valid statement, created before by this executor
SQLException
- Any problem that occurs during executionpublic int execute(String sql) throws SQLException
sql
- A valid SQL statement (no SELECT allowed here!)
SQLException
- Any problem that occurs during executionpublic boolean executeSQL(String sql)
sql
- A valid SQL statement (no SELECT allowed here!)public void close()
public void closeStatement(Statement statement)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |