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


Java TableUtils.clearTable方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Apptitive,项目名称:Ramadan,代码行数:17,代码来源:DbHelper.java

示例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);
    }
}
 
开发者ID:remipassmoilesel,项目名称:simple-hostel-management,代码行数:13,代码来源:AbstractDaoService.java

示例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);
}
 
开发者ID:seeing-eye,项目名称:UnforgetIt,代码行数:9,代码来源:TaskRepositoryJPAImplTest.java

示例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);
}
 
开发者ID:seeing-eye,项目名称:UnforgetIt,代码行数:9,代码来源:AddSomeTasksToDBTest.java

示例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();
    }
}
 
开发者ID:wuyinlei,项目名称:CaiNiaoMes,代码行数:10,代码来源:OrmDBHelper.java

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

示例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);
  }
}
 
开发者ID:bnsantos,项目名称:android-upload-service,代码行数:8,代码来源:PersistenceManager.java

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

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

示例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();
}
 
开发者ID:realm,项目名称:realm-java-benchmarks,代码行数:32,代码来源:TestOrmLite.java

示例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);
    }
}
 
开发者ID:realm,项目名称:realm-java-benchmarks,代码行数:9,代码来源:TestOrmLite.java

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

示例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);
}
 
开发者ID:AfirSraftGarrier,项目名称:ACCAndroid,代码行数:9,代码来源:BaseDatabaseHelper.java

示例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);
}
 
开发者ID:AfirSraftGarrier,项目名称:ACCAndroid,代码行数:9,代码来源:BaseDatabaseHelper.java

示例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();
    }
}
 
开发者ID:ayaseruri,项目名称:tongnews,代码行数:8,代码来源:DataHelper.java


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