Package io.ebean
Interface ScriptRunner
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 TypeMethodDescriptionvoid
Run a script given the resource path (that should start with "/").void
Run a script given the resource path (that should start with "/") and place holders.void
Run a DDL or SQL script given the resource.void
Run a DDL or SQL script given the resource and place holders.void
Run 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. -
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
-