本文整理匯總了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();
}
}