|
|||||||||
| 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(javax.sql.DataSource aDataSource)
Initialize the new instance with default values. |
|
| Method Summary | |
|---|---|
void |
close()
Closes all open connections. |
void |
closeStatement(java.sql.Statement statement)
Closes the given statement. |
int |
execute(java.lang.String sql)
Executes the given SQL command and returns the number of affected rows. |
boolean |
executeSQL(java.lang.String sql)
Executes the given SQL command and returns true if the execution was successful. |
int |
executeWriteStatement(java.sql.PreparedStatement statement)
Executes the given statement and returns the number of affected rows. |
java.sql.PreparedStatement |
prepareWriteStatement(java.lang.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(javax.sql.DataSource aDataSource)
aDataSource - The datasource the executor should connect to (must not be null)| Method Detail |
|---|
public java.sql.PreparedStatement prepareWriteStatement(java.lang.String sql)
throws java.sql.SQLException
sql - A valid SQL statement with placeholders (?) (no SELECT allowed here!)
java.sql.SQLException - Any problem that occurs during execution
public int executeWriteStatement(java.sql.PreparedStatement statement)
throws java.sql.SQLException
statement - A valid statement, created before by this executor
java.sql.SQLException - Any problem that occurs during execution
public int execute(java.lang.String sql)
throws java.sql.SQLException
sql - A valid SQL statement (no SELECT allowed here!)
java.sql.SQLException - Any problem that occurs during executionpublic boolean executeSQL(java.lang.String sql)
sql - A valid SQL statement (no SELECT allowed here!)public void close()
public void closeStatement(java.sql.Statement statement)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||