public class DefaultDatabaseUtility extends org.springframework.jdbc.core.support.JdbcDaoSupport implements DatabaseUtility
Constructor and Description |
---|
DefaultDatabaseUtility() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
adjustForCommonAndTableSetPrefixes(java.lang.String script,
java.lang.String commonPrefix,
java.lang.String tableSetPrefix)
Adjust for prefix.
|
protected java.lang.String |
adjustForPrefix(java.lang.String script,
java.lang.String prefix) |
static java.lang.String |
convertResourceToString(org.springframework.core.io.Resource resource)
Convert resource to string.
|
boolean |
doesTableExist(java.lang.String tableName)
Does table exist.
|
void |
dropDatabase(java.lang.String databaseName)
Drop database.
|
void |
executeScript(org.springframework.core.io.Resource creationScript)
Execute script.
|
void |
executeScript(org.springframework.core.io.Resource creationScript,
java.lang.String tableSetPrefix) |
void |
executeScript(org.springframework.core.io.Resource creationScript,
java.lang.String defaultPrefix,
java.lang.String tableSetPrefix)
Execute script.
|
void |
executeScript(java.lang.String script)
Execute script.
|
void |
executeScript(java.lang.String script,
java.lang.String tableSetPrefix) |
void |
executeScript(java.lang.String script,
java.lang.String defaultPrefix,
java.lang.String tableSetPrefix) |
void |
truncateTable(java.lang.String tableName)
Truncate table.
|
public void dropDatabase(java.lang.String databaseName)
DatabaseUtility
dropDatabase
in interface DatabaseUtility
databaseName
- the database namepublic void executeScript(org.springframework.core.io.Resource creationScript) throws java.lang.Exception
DatabaseUtility
executeScript
in interface DatabaseUtility
creationScript
- the creation scriptjava.lang.Exception
- the exceptionpublic void executeScript(org.springframework.core.io.Resource creationScript, java.lang.String defaultPrefix, java.lang.String tableSetPrefix) throws java.lang.Exception
DatabaseUtility
executeScript
in interface DatabaseUtility
creationScript
- the creation scriptjava.lang.Exception
- the exceptionpublic void executeScript(org.springframework.core.io.Resource creationScript, java.lang.String tableSetPrefix) throws java.lang.Exception
executeScript
in interface DatabaseUtility
java.lang.Exception
public void executeScript(java.lang.String script, java.lang.String tableSetPrefix) throws java.lang.Exception
executeScript
in interface DatabaseUtility
java.lang.Exception
public void executeScript(java.lang.String script, java.lang.String defaultPrefix, java.lang.String tableSetPrefix) throws java.lang.Exception
executeScript
in interface DatabaseUtility
java.lang.Exception
public void executeScript(java.lang.String script) throws java.lang.Exception
DatabaseUtility
executeScript
in interface DatabaseUtility
script
- the creation scriptjava.lang.Exception
- the exceptionpublic static java.lang.String convertResourceToString(org.springframework.core.io.Resource resource)
resource
- the resourceprotected java.lang.String adjustForCommonAndTableSetPrefixes(java.lang.String script, java.lang.String commonPrefix, java.lang.String tableSetPrefix)
script
- the scriptprefix
- the prefixprotected java.lang.String adjustForPrefix(java.lang.String script, java.lang.String prefix)
public void truncateTable(java.lang.String tableName) throws java.lang.Exception
DatabaseUtility
truncateTable
in interface DatabaseUtility
tableName
- the table namejava.lang.Exception
- the exceptionpublic boolean doesTableExist(java.lang.String tableName)
DatabaseUtility
doesTableExist
in interface DatabaseUtility
tableName
- the table name