Package org.dbunit

Class DdlExecutor

java.lang.Object
org.dbunit.DdlExecutor

public final class DdlExecutor extends Object
Test Helper class for Executing DDL.
Since:
DbUnit 2.6.0
Version:
$Revision$
Author:
Andrew Landsverk
  • Method Details

    • execute

      public static void execute(String ddlFileName, Connection connection, boolean multiLineSupport) throws Exception
      Execute DDL from the file (by name) against the given Connection, dispatches to executeDdlFile and passes false for ignoreErrors.
      Parameters:
      ddlFileName - The name of the DDL file to execute.
      connection - The Connection to execute the DDL against.
      multiLineSupport - If this DataSource supports passing in all the lines at once or if it needs to separate on ';'.
      Throws:
      Exception
    • execute

      public static void execute(String ddlFileName, Connection connection, boolean multiLineSupport, boolean ignoreErrors) throws Exception
      Execute DDL from the file (by name) against the given Connection, dispatches to executeDdlFile.
      Parameters:
      ddlFileName - The name of the DDL file to execute.
      connection - The Connection to execute the DDL against.
      multiLineSupport - If this DataSource supports passing in all the lines at once or if it needs to separate on ';'.
      ignoreErrors - Set this to true if you want syntax errors to be ignored.
      Throws:
      Exception
    • executeDdlFile

      public static void executeDdlFile(File ddlFile, Connection connection) throws Exception
      Executes DDL from the File against the given Connection. Retrieves the multiLineSupport parameter from the profile.
      Parameters:
      ddlFile - The File object of the DDL file to execute.
      connection - The Connection to execute the DDL against.
      Throws:
      Exception
    • executeDdlFile

      public static void executeDdlFile(File ddlFile, Connection connection, boolean multiLineSupport) throws Exception
      Executes DDL from the File against the given Connection. Retrieves the multiLineSupport parameter from the profile and passes false for ignoreErrors.
      Parameters:
      ddlFile - The File object of the DDL file to execute.
      connection - The Connection to execute the DDL against.
      multiLineSupport - If this DataSource supports passing in all the lines at once or if it needs to separate on ';'.
      Throws:
      Exception
    • executeDdlFile

      public static void executeDdlFile(File ddlFile, Connection connection, boolean multiLineSupport, boolean ignoreErrors) throws Exception
      Execute DDL from the File against the given Connection.
      Parameters:
      ddlFile - The File object of the DDL file to execute.
      connection - The Connection to execute the DDL against.
      multiLineSupport - If this DataSource supports passing in all the lines at once or if it needs to separate on ';'.
      ignoreErrors - Set this to true if you want syntax errors to be ignored.
      Throws:
      Exception
    • executeSql

      public static void executeSql(Connection connection, String sql) throws SQLException
      Execute an un-prepared SQL statement against the given Connection, passes false to ignoreErrors.
      Parameters:
      connection - The Connection to execute against
      sql - The SQL String to execute
      Throws:
      SQLException
    • executeSql

      public static void executeSql(Connection connection, String sql, boolean ignoreErrors) throws SQLException
      Execute an un-prepared SQL statement against the given Connection.
      Parameters:
      connection - The Connection to execute against
      sql - The SQL String to execute
      ignoreErrors - Set this to true if you want syntax errors to be ignored.
      Throws:
      SQLException