public class SchemaUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> int |
createSchema(ConnectionSource connectionSource,
Class<T> dataClass)
Issue the database statements to create the schema associated with a class.
|
static <T> int |
createSchema(ConnectionSource connectionSource,
String schemaName)
Issue the database statements to create the schema associated with a schema configuration.
|
static int |
createSchema(Dao<?,?> dao)
Issue the database statements to create the schema associated with a table configuration.
|
static <T> int |
createSchemaIfNotExists(ConnectionSource connectionSource,
Class<T> dataClass)
Create a schema if it does not already exist.
|
static <T> int |
createSchemaIfNotExists(ConnectionSource connectionSource,
String schemaName)
Create a schema if it does not already exist.
|
static <T,ID> int |
dropSchema(ConnectionSource connectionSource,
Class<T> dataClass,
boolean ignoreErrors)
Issue the database statements to drop the schema associated with a class.
|
static <T,ID> int |
dropSchema(ConnectionSource connectionSource,
String schemaName,
boolean ignoreErrors)
Issue the database statements to drop the schema associated with a schema configuration.
|
static <T> List<String> |
getCreateSchemaStatements(DatabaseType databaseType,
String schemaName)
Return an list of SQL statements that need to be run to create a schema.
|
public static <T> int createSchema(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
connectionSource
- Associated connection source.dataClass
- The class for which a schema will be created.SQLException
public static int createSchema(Dao<?,?> dao) throws SQLException
dao
- Associated dao.SQLException
public static <T> int createSchemaIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
SQLException
public static <T> int createSchema(ConnectionSource connectionSource, String schemaName) throws SQLException
connectionSource
- connectionSource Associated connection source.schemaName
- schema nameSQLException
public static <T> int createSchemaIfNotExists(ConnectionSource connectionSource, String schemaName) throws SQLException
SQLException
public static <T> List<String> getCreateSchemaStatements(DatabaseType databaseType, String schemaName)
createSchema(com.j256.ormlite.support.ConnectionSource, java.lang.Class<T>)
.databaseType
- The type of database which will be executing the create schema statements.schemaName
- Schema Name.public static <T,ID> int dropSchema(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException
WARNING: This is [obviously] very destructive and is unrecoverable.
connectionSource
- Associated connection source.dataClass
- The class for which a schema will be dropped.ignoreErrors
- If set to true then try each statement regardless of SQLException
thrown previously.SQLException
public static <T,ID> int dropSchema(ConnectionSource connectionSource, String schemaName, boolean ignoreErrors) throws SQLException
WARNING: This is [obviously] very destructive and is unrecoverable.
connectionSource
- Associated connection source.schemaName
- schema nameignoreErrors
- If set to true then try each statement regardless of SQLException
thrown previously.SQLException
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.