org.bitrepository.service.database
Class SqlScriptRunner

java.lang.Object
  extended by org.bitrepository.service.database.SqlScriptRunner

public class SqlScriptRunner
extends Object

Runs a sql script as a sequence of JDBC statements. Slightly modified version of the com.ibatis.common.jdbc.SqlScriptRunner class from the iBATIS Apache project. Only removed dependency on Resource class and a constructor


Constructor Summary
SqlScriptRunner(Connection connection, boolean autoCommit, boolean stopOnError)
           
 
Method Summary
 void runScript(Reader reader)
          Runs an SQL script (read in using the Reader parameter)
 void setDelimiter(String delimiter, boolean fullLineDelimiter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlScriptRunner

public SqlScriptRunner(Connection connection,
                       boolean autoCommit,
                       boolean stopOnError)
Parameters:
connection - The connection to use
autoCommit - Enable autocommit
stopOnError - Stop running the script, if a statement fails.
Method Detail

setDelimiter

public void setDelimiter(String delimiter,
                         boolean fullLineDelimiter)
Parameters:
delimiter - The statement delimiter, eg. ';' for mysql.
fullLineDelimiter - true if the delimiter used to distinguise between lines.

runScript

public void runScript(Reader reader)
               throws IOException,
                      SQLException
Runs an SQL script (read in using the Reader parameter)

Parameters:
reader - - the source of the script
Throws:
IOException
SQLException


Copyright © 2010-2013 The State and University Library, The Royal Library and The State Archives, Denmark. All Rights Reserved.