org.radrails.db.internal.ui.editors.sql.util
Class SQLExecuteHelper

java.lang.Object
  extended byorg.radrails.db.internal.ui.editors.sql.util.SQLExecuteHelper

public class SQLExecuteHelper
extends java.lang.Object

Class that helps to parse a String of SQL statements executing them one by one and handling errors gracefully.

Version:
0.5.1
Author:
mbaumbach, Kyle

Method Summary
static SQLExecuteHelper getInstance()
          Gets an instance of this class.
 boolean runSQLFile(org.eclipse.core.resources.IFile file, java.lang.String env)
          Executes the statements
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SQLExecuteHelper getInstance()
Gets an instance of this class.

Returns:
A SQLExecuteHelper object.

runSQLFile

public boolean runSQLFile(org.eclipse.core.resources.IFile file,
                          java.lang.String env)
                   throws java.io.FileNotFoundException,
                          java.sql.SQLException,
                          java.lang.InstantiationException,
                          java.lang.IllegalAccessException,
                          java.io.IOException,
                          org.eclipse.core.runtime.CoreException
Executes the statements

Parameters:
file - The SQL file to execute.
env - The environment to run from the project's file.
Returns:
true if the SQL file executed successfully, false otherwise.
Throws:
java.io.FileNotFoundException - If the file could not found.
java.sql.SQLException - If an error occurred while executing the SQL statement.
java.lang.InstantiationException - If the database driver could not be instantiated.
java.lang.IllegalAccessException - If the user does not have access to the database.
java.io.IOException - If an I/O exception occurs.
org.eclipse.core.runtime.CoreException - If an exception happens within Eclipse.