本文整理汇总了Java中com.j256.ormlite.table.TableUtils.dropTable方法的典型用法代码示例。如果您正苦于以下问题:Java TableUtils.dropTable方法的具体用法?Java TableUtils.dropTable怎么用?Java TableUtils.dropTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.table.TableUtils
的用法示例。
在下文中一共展示了TableUtils.dropTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTable
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
private void updateTable(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
TableUtils.dropTable(connectionSource, MyPhoto.class, true);
TableUtils.dropTable(connectionSource, MyMoment.class, true);
TableUtils.dropTable(connectionSource, MyMomentPhoto.class, true);
TableUtils.dropTable(connectionSource, MyFace.class, true);
TableUtils.dropTable(connectionSource, MyFacePhoto.class, true);
TableUtils.dropTable(connectionSource, UploadedPhoto.class, true);
TableUtils.dropTable(connectionSource, MyAlbum.class, true);
TableUtils.dropTable(connectionSource, MyAlbumPhoto.class, true);
TableUtils.dropTable(connectionSource, MyTag.class, true);
TableUtils.dropTable(connectionSource, MyTagPhoto.class, true);
TableUtils.dropTable(connectionSource, MyCursor.class, true);
TableUtils.dropTable(connectionSource, MySetting.class, true);
onCreate(db, connectionSource);
} catch (Exception e) {
Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例2: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* 处理数据库版本升级
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
Log.I(TAG, "--------------------- onUpgrade ---------------------");
int version = oldVersion;
if (version < 4) {
upgradeFor2(db);
version = 3;
}
if (version != DATABASE_VERSION) {
Log.W(TAG, "Destroying all old data.");
try {
Log.I(TAG, "--------------------- onUpgrade ---------------------");
TableUtils.dropTable(connectionSource, AlbumInfo.class, true);
TableUtils.dropTable(connectionSource, PhotoInfo.class, true);
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.E(TAG, "Can't drop databases", e);
throw new RuntimeException(e);
}
}
}
示例3: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher version number. This allows you to adjust
* the various data to match the new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
Log.i(TAG, "onUpgrade");
TableUtils.dropTable(connectionSource, SuspectedApp.class, true);
Log.d(TAG, String.format("Dropped suspected app table!"));
Dao<WhiteEntry, Integer> whiteListDao = getWhiteListDao();
DeleteBuilder<WhiteEntry, Integer> deleteBuilder = whiteListDao.deleteBuilder();
deleteBuilder.where().eq("systemEntry", Boolean.TRUE);
int deleted = deleteBuilder.delete();
Log.d(TAG, String.format("Delete %d old system whitelist entries", deleted));
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(TAG, "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例4: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* Updates the DB given its {@code oldVersion} and its new {@code newVersion}
*
* @param oldVersion
* The old version of the DB
* @param newVersion
* The new version of the DB
*/
private void onUpgrade(int oldVersion, int newVersion) {
try {
Log.i(TAG_LOG, "The DB onUpgrade");
// Just in this case: Drop all tables and create the DB again
TableUtils.dropTable(connectionSource, Alarm.class, true);
TableUtils.dropTable(connectionSource, Playlist.class, true);
TableUtils.dropTable(connectionSource, Song.class, true);
onCreate();
} catch (SQLException e) {
Log.e(TAG_LOG, "An error has occurred while updating the DB", e);
throw new RuntimeException(e);
}
}
示例5: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion)
{
try
{
setupClasses();
for ( Class aClass : entityClasses )
{
TableUtils.dropTable(connectionSource, aClass, true);
}
onCreate(database, connectionSource);
}
catch ( SQLException e )
{
PFALogger.error(getClass().getName(), ON_UPGRADE, e);
}
}
示例6: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* 处理数据库版本升级
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion)
{
try
{
Log.I(TAG, "--------------------- onUpgrade ---------------------");
TableUtils.dropTable(connectionSource, MyFavorites.class, true);
TableUtils.dropTable(connectionSource, FocusItemInfo.class, true);
onCreate(db, connectionSource);
}
catch (SQLException e)
{
Log.E(TAG, "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例7: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion,
int newVersion) {
try {
TableUtils.dropTable(connectionSource, Cart.class, true);
TableUtils.dropTable(connectionSource, CartEntry.class, true);
TableUtils.dropTable(connectionSource, Product.class, true);
TableUtils.dropTable(connectionSource, AutoCompleteWords.class, true);
TableUtils.dropTable(connectionSource, News.class, true);
TableUtils.dropTable(connectionSource, ICal.class, true);
TableUtils.dropTable(connectionSource, Project.class, true);
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(TAG, "Can't drop database", e);
throw new RuntimeException(e);
}
}
示例8: deleteFeatureTileLinkExtension
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* Delete the Feature Tile Link extension including the extension entries
* and custom tables
*
* @param geoPackage
* @param ignoreErrors
* @since 1.1.5
*/
public static void deleteFeatureTileLinkExtension(
GeoPackageCore geoPackage, boolean ignoreErrors) {
FeatureTileLinkDao featureTileLinkDao = geoPackage
.getFeatureTileLinkDao();
ExtensionsDao extensionsDao = geoPackage.getExtensionsDao();
ConnectionSource connectionSource = geoPackage.getDatabase()
.getConnectionSource();
try {
if (featureTileLinkDao.isTableExists()) {
TableUtils.dropTable(connectionSource, FeatureTileLink.class,
ignoreErrors);
}
if (extensionsDao.isTableExists()) {
extensionsDao.deleteByExtension(
FeatureTileTableCoreLinker.EXTENSION_NAME);
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to delete Feature Tile Link extension and table. GeoPackage: "
+ geoPackage.getName(), e);
}
}
示例9: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher version number. This allows you to adjust
* the various data to match the new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
Log.i(DatabaseHelper.class.getName(), "onUpgrade");
TableUtils.dropTable(connectionSource, AddressBook.class, true);
TableUtils.dropTable(connectionSource, AddressItem.class, true);
TableUtils.dropTable(connectionSource, Contact.class, true);
TableUtils.dropTable(connectionSource, SimpleAddressItem.class, true);
// after we drop the old databases, we create the new ones
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例10: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher
* version number. This allows you to adjust the various data to match the
* new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,
int oldVersion, int newVersion) {
switch (oldVersion) {
default:
try {
Log.i(DatabaseHelper.class.getName(), "onUpgrade");
TableUtils.dropTable(connectionSource, DNSResponse.class, true);
// after we drop the old databases, we create the new ones
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
}
示例11: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion)
{
for(int i = tableClasses.length - 1; i >= 0; i--)
{
Class tableClass = tableClasses[i];
try
{
TableUtils.dropTable(connectionSource, tableClass, true);
}
catch(SQLException e)
{
throw new RuntimeException(e);
}
}
onCreate(database, connectionSource);
}
示例12: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
Log.i(Constant.TAG, "onUpgrade");
TableUtils.dropTable(connectionSource, ItemGridModel.class, true);
TableUtils.dropTable(connectionSource, AuthorModel.class, true);
TableUtils.dropTable(connectionSource, ClassRoomModel.class, true);
TableUtils.dropTable(connectionSource, TypeModel.class, true);
TableUtils.dropTable(connectionSource, DayModel.class, true);
TableUtils.dropTable(connectionSource, TimeModel.class, true);
TableUtils.dropTable(connectionSource, AboutModel.class, true);
onCreate(db, connectionSource);
}
catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例13: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase database, ConnectionSource cs, int oldVersion,
int newVersion)
{
try
{
TableUtils.dropTable(cs, Commitment.class, true);
TableUtils.dropTable(cs, Commit.class, true);
onCreate(database, cs);
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例14: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion, int newVersion) {
try {
logger.i("onUpgrade");
TableUtils.dropTable(connectionSource, Event.class, true);
TableUtils.dropTable(connectionSource, Article.class, true);
TableUtils.dropTable(connectionSource, Contact.class, true);
TableUtils.dropTable(connectionSource, Material.class, true);
TableUtils.dropTable(connectionSource, Sponsor.class, true);
onCreate(db, connectionSource);
} catch (SQLException e) {
logger.e("Can't drop databases", e);
throw new RuntimeException(e);
}
}
示例15: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase sqliteDatabase,
ConnectionSource connectionSource, int oldVer, int newVer) {
// TODO Auto-generated method stub
try {
TableUtils.dropTable(connectionSource, Rw.class, true);
TableUtils.dropTable(connectionSource, Rwda.class, true);
onCreate(sqliteDatabase, connectionSource);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(),
"Unable to upgrade database from version " + oldVer
+ " to new " + newVer, e);
}
}