当前位置: 首页>>代码示例>>Java>>正文


Java TableUtils.dropTable方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:21,代码来源:DatabaseHelper.java

示例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);
		}
	}

}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:29,代码来源:DatabaseHelper.java

示例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);
    }
}
 
开发者ID:geeksonsecurity,项目名称:android-overlay-protection,代码行数:22,代码来源:DatabaseHelper.java

示例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);
  }
}
 
开发者ID:aajn88,项目名称:wakemeapp,代码行数:24,代码来源:DatabaseHelper.java

示例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);
    }
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:18,代码来源:DataBaseHelper.java

示例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);
	}
}
 
开发者ID:benniaobuguai,项目名称:android-project-wo2b,代码行数:21,代码来源:UserDatabaseHelper.java

示例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);
    }
}
 
开发者ID:FAU-Inf2,项目名称:fablab-android,代码行数:18,代码来源:DatabaseHelper.java

示例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);
	}

}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:33,代码来源:NGAExtensions.java

示例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);
    }
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:20,代码来源:DatabaseHelper.java

示例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);
		}
	}
}
 
开发者ID:tommy4711,项目名称:gaeproxy,代码行数:22,代码来源:DatabaseHelper.java

示例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);
}
 
开发者ID:DoSomethingArchive,项目名称:LetsDoThis-Android,代码行数:19,代码来源:DatabaseHelper.java

示例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);
    }
}
 
开发者ID:clovisjunior,项目名称:ftsl_app,代码行数:21,代码来源:DatabaseHelper.java

示例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();
	}
}
 
开发者ID:mauriciogior,项目名称:commit-android,代码行数:17,代码来源:DatabaseHelper.java

示例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);
    }
}
 
开发者ID:LVOUG,项目名称:lvoug-app-android,代码行数:17,代码来源:DatabaseHelper.java

示例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);
	}
	

}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:17,代码来源:DatabaseHelper.java


注:本文中的com.j256.ormlite.table.TableUtils.dropTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。