本文整理汇总了Java中com.j256.ormlite.table.TableUtils.clearTable方法的典型用法代码示例。如果您正苦于以下问题:Java TableUtils.clearTable方法的具体用法?Java TableUtils.clearTable怎么用?Java TableUtils.clearTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.table.TableUtils
的用法示例。
在下文中一共展示了TableUtils.clearTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpgrade
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource, int oldVersion, int newVersion) {
List<String> allSql = new ArrayList<String>();
try {
TableUtils.clearTable(connectionSource, Region.class);
TableUtils.clearTable(connectionSource, TimeTable.class);
CSVToDbHelper.readCSVAndInserIntoDb(context,R.raw.region, DbTableName.Region );
CSVToDbHelper.readCSVAndInserIntoDb(context,R.raw.timetable, DbTableName.TimeTable );
for (String sql : allSql) {
sqLiteDatabase.execSQL(sql);
}
} catch (Exception e) {
Log.e(DbHelper.class.getName(), "exception during onUpgrade", e);
throw new RuntimeException(e);
}
}
示例2: clearAllEntities
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* Clear all entities in this repository
*
* @throws IOException
*/
public void clearAllEntities() throws IOException {
try {
TableUtils.clearTable(connection, clazz);
} catch (SQLException e) {
throw new IOException(e);
}
}
示例3: setUp
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Before
public void setUp() throws SQLException {
Context context = InstrumentationRegistry.getTargetContext();
TableUtils.clearTable(DataBaseJPAHelper
.getInstance(context)
.getConnectionSource(), Task.class);
repository = TaskRepositoryJPAImpl.getInstance(context);
}
示例4: setUp
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Before
public void setUp() throws SQLException {
Context context = InstrumentationRegistry.getTargetContext();
TableUtils.clearTable(DataBaseJPAHelper
.getInstance(context)
.getConnectionSource(), Task.class);
repository = (TaskRepositoryJPAImpl) TaskRepositoryJPAImpl.getInstance(context);
}
示例5: onCreate
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase, ConnectionSource connectionSource) {
try {
TableUtils.clearTable(connectionSource, Message.class);
TableUtils.clearTable(connectionSource, Conversation.class);
} catch (SQLException e) {
e.printStackTrace();
}
}
示例6: clearDatabase
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void clearDatabase(ConnectionSource connectionSource) {
try {
TableUtils.clearTable(connectionSource, Restaurand.class);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
示例7: clearTables
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void clearTables() {
try {
TableUtils.clearTable(connectionSource, Item.class);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
示例8: clearData
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
/**
* Deletes all data from the DB.
*/
public void clearData() {
Set<Class<?>> registeredModels = DbModelRegistry.getRegisteredModels();
for (Class<?> registeredModel : registeredModels) {
try {
TableUtils.clearTable(connectionSource, registeredModel);
} catch (SQLException e) {
DebugLog.logException(e);
}
}
}
示例9: deleteAllDbRequests
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void deleteAllDbRequests() {
try {
TableUtils.clearTable(connectionSource, DbRequest.class);
} catch (SQLException e) {
log.error("Unhandled exception", e);
}
}
示例10: testDelete
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
@Override
public void testDelete() {
setUp();
Benchmark benchmark = new Benchmark() {
@Override
public void setUp() {
// Do nothing
}
@Override
public void tearDown() {
// Do nothing
}
@Override
protected void prepareRun() {
addObjects();
}
@Override
public void run() {
try {
TableUtils.clearTable(dbHelper.getConnectionSource(), Employee.class);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
};
measurements.put(TEST_DELETE, benchmark.execute(warmupIterations, testIterations));
tearDown();
}
示例11: deleteObjects
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
private void deleteObjects() {
ConnectionSource connectionSource = dbHelper.getConnectionSource();
try {
TableUtils.clearTable(connectionSource, Employee.class);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
示例12: clearTable
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void clearTable(Class dbClass) {
try {
TableUtils.clearTable(connectionSource, dbClass);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't clean table", e);
throw new RuntimeException(e);
}
}
示例13: refreshDao
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
private <T> void refreshDao(Dao dao, List objects) throws SQLException {
if (ListUtil.isEmpty(objects)) {
return;
}
TableUtils.clearTable(getConnectionSource(), objects.get(0).getClass());
// this.deleteDaoAll(dao);
this.add(objects);
}
示例14: refresh
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void refresh(Object object) throws SQLException {
if (object == null) {
return;
}
TableUtils
.clearTable(getConnectionSource(), ClassUtil.getClass(object));
this.add(object);
}
示例15: clearTable
import com.j256.ormlite.table.TableUtils; //导入方法依赖的package包/类
public void clearTable(Class clazz){
try {
TableUtils.clearTable(this.getConnectionSource(), clazz);
} catch (SQLException e) {
e.printStackTrace();
}
}