當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。