public interface ScriptRunner
Runs DDL and SQL scripts.
Typically these are scripts used for testing such as seed SQL scripts or truncate SQL scripts.
Scripts are executed in their own transaction and committed on successful completion.
Example of simple use
Database database = DB.getDefault();
database.script().run("/scripts/test-script.sql");
-
Method Summary
Modifier and TypeMethodDescriptionvoidRun a script given the resource path (that should start with "/").voidRun a script given the resource path (that should start with "/") and place-holders.voidRun a DDL or SQL script given the resource.voidRun a DDL or SQL script given the resource and place-holders.voidRun a DDL or SQL script given the file.voidRun a DDL or SQL script given the file and place-holders.voidRun the raw provided DDL or SQL script.
-
Method Details
-
run
Run a script given the resource path (that should start with "/"). -
run
Run a script given the resource path (that should start with "/") and place-holders.Map<String,String> placeholders = new HashMap<>(); placeholders.put("tableName", "e_basic"); Database database = DB.getDefault(); database.script().run("/scripts/test-script.sql", placeholders); -
run
Run a DDL or SQL script given the resource. -
run
Run a DDL or SQL script given the resource and place-holders. -
run
Run a DDL or SQL script given the file. -
run
Run a DDL or SQL script given the file and place-holders. -
runScript
Run the raw provided DDL or SQL script.- Parameters:
name- The name of the script for logging purposescontent- The SQL contentuseAutoCommit- Set to true to use auto commit true and continue when any errors occur
-