| java.lang.Object com.quadcap.sql.tools.Loader
Loader | public class Loader (Code) | | A simple SQL loader utility which scans the input file for
semicolon-delimited SQL statements which are executed using JDBC
against a database connection. If a statement generates a ResultSet,
the ResultSet is displayed to a PrintWriter.
author: Stan Bailes |
COLMAX | final static int COLMAX(Code) | | |
Loader | public Loader()(Code) | | No-argument bean constructor. We need a connection to do something
useful.
|
Loader | public Loader(Connection conn)(Code) | | Construct a new Loader object bound to the specified database
connection
Parameters: conn - the database connection |
execute | public void execute(String sql)(Code) | | Execute a single SQL statement. There are several statements that
are not passed directly to the JDBC driver, but instead are executed
by the loader:
BEGINTRANSACTION |
Upon seeing this, the loader performs a
Connection.setAutoCommit(false) call on the
current database connection. |
ENDTRANSACTION |
The loader performs:
Connection.commit()
Connection.setAutocommit(true);
|
LIMITK |
The loader performs:
Connection.rollback()
Connection.setAutocommit(true);
|
Parameters: sql - the SQL statement to execute. |
getConnection | public Connection getConnection()(Code) | | Get this loader's database connection
the current database connection |
getWriter | public PrintWriter getWriter()(Code) | | Return the loader's writer.
the current writer. |
loadFile | public void loadFile(String filename)(Code) | | The specified file is scanned for semicolon-delimited SQL statements
which are executed one at a time.
Parameters: filename - the name of the input file See Also: execute |
setConnection | public void setConnection(Connection conn)(Code) | | Set this loader's database connection
Parameters: conn - the new database connection |
setWriter | public void setWriter(PrintWriter writer)(Code) | | Set the loader's writer object. Depending on the loader's
trace level, the loader will write a trace of SQL statement execution
to this writer.
Parameters: writer - the new writer object |
|
|