|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.spy.SpyObject
net.spy.db.SQLRunner
Run a SQL script from an InputStream.
SQL scripts run by this class are slightly special over normal SQL scripts in that they require a particular structure.
Lines beginning with a SQL comment (--) are logged at info level. Queries are executed when a semicolon is encountered on a line all by itself. Empty lines are ignored. Everything else is concatenated to form the next query to execute. Queries that return a result set will throw a SQLException.
| Constructor Summary | |
SQLRunner(Connection conn)
Get an instance of SQLRunner. |
|
| Method Summary | |
void |
runScript(InputStream is)
Run the given script as a transaction. |
void |
runScript(InputStream is,
boolean autocommit,
boolean errok)
Run the given script. |
void |
setTimeout(int timeout)
Set the query timeout (in seconds). |
| Methods inherited from class net.spy.SpyObject |
getLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SQLRunner(Connection conn)
| Method Detail |
public void setTimeout(int timeout)
public void runScript(InputStream is)
throws SQLException,
IOException
is - the stream containing the script
SQLException - if there's a SQL problem with this script
IOException - if there's a problem reading the script
public void runScript(InputStream is,
boolean autocommit,
boolean errok)
throws SQLException,
IOException
is - the stream containing the scriptautocommit - if true, commit after each statementerrok - if true, ignore SQL exceptions on each statement
SQLException - if there's a SQL problem executing the script
IOException - if there's a problem reading the script
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||