|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.ormlite.table.TableUtils
public class TableUtils
Couple utility methods for the creating, dropping, and maintenance of tables.
Method Summary | ||
---|---|---|
static
|
clearTable(ConnectionSource connectionSource,
Class<T> dataClass)
Clear all data out of the table. |
|
static
|
clearTable(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig)
Clear all data out of the table. |
|
static
|
createTable(ConnectionSource connectionSource,
Class<T> dataClass)
Issue the database statements to create the table associated with a class. |
|
static
|
createTable(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig)
Issue the database statements to create the table associated with a table configuration. |
|
static
|
createTableIfNotExists(ConnectionSource connectionSource,
Class<T> dataClass)
Create a table if it does not already exist. |
|
static
|
createTableIfNotExists(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig)
Create a table if it does not already exist. |
|
static
|
dropTable(ConnectionSource connectionSource,
Class<T> dataClass,
boolean ignoreErrors)
Issue the database statements to drop the table associated with a class. |
|
static
|
dropTable(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors)
Issue the database statements to drop the table associated with a table configuration. |
|
static
|
getCreateTableStatements(ConnectionSource connectionSource,
Class<T> dataClass)
Return an ordered collection of SQL statements that need to be run to create a table. |
|
static
|
getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig)
Return an ordered collection of SQL statements that need to be run to create a table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
connectionSource
- Associated connection source.dataClass
- The class for which a table will be created.
SQLException
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
SQLException
public static <T> int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException
connectionSource
- connectionSource Associated connection source.tableConfig
- Hand or spring wired table configuration. If null then the class must have DatabaseField
annotations.
SQLException
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException
SQLException
public static <T,ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
createTable(com.j256.ormlite.support.ConnectionSource, java.lang.Class)
.
connectionSource
- Our connect source which is used to get the database type, not to apply the creates.dataClass
- The class for which a table will be created.
SQLException
public static <T,ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException
createTable(com.j256.ormlite.support.ConnectionSource, java.lang.Class)
.
connectionSource
- Our connect source which is used to get the database type, not to apply the creates.tableConfig
- Hand or spring wired table configuration. If null then the class must have DatabaseField
annotations.
SQLException
public static <T,ID> int dropTable(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 table will be dropped.ignoreErrors
- If set to true then try each statement regardless of SQLException
thrown previously.
SQLException
public static <T,ID> int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig, boolean ignoreErrors) throws SQLException
WARNING: This is [obviously] very destructive and is unrecoverable.
connectionSource
- Associated connection source.tableConfig
- Hand or spring wired table configuration. If null then the class must have DatabaseField
annotations.ignoreErrors
- If set to true then try each statement regardless of SQLException
thrown previously.
SQLException
public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException
WARNING: This is [obviously] very destructive and is unrecoverable.
SQLException
public static <T> int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException
WARNING: This is [obviously] very destructive and is unrecoverable.
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |