Java Code Examples for com.raizlabs.android.dbflow.sql.language.Delete#table()

The following examples show how to use com.raizlabs.android.dbflow.sql.language.Delete#table() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static void addFun_Part(List<Results> results) {
    Delete.table(PartDbBean.class);
    for (Results result : results) {
        PartDbBean partDbBean = new PartDbBean();
        partDbBean.who = result.getWho();
        partDbBean.publishedAt = result.getPublishedAt();
        partDbBean.desc = result.getDesc();
        partDbBean.type = result.getType();
        partDbBean.url = result.getUrl();
        partDbBean.used = result.getUsed();
        partDbBean.objectId = result.get_id();
        partDbBean.createdAt = result.getCreatedAt();
        partDbBean.save();
    }

}
 
Example 2
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static void addFun_Girly(List<Results> results) {
    Delete.table(GirlyDbBean.class);
    for (Results result : results) {
        GirlyDbBean girlyDbBean = new GirlyDbBean();
        girlyDbBean.who = result.getWho();
        girlyDbBean.publishedAt = result.getPublishedAt();
        girlyDbBean.desc = result.getDesc();
        girlyDbBean.type = result.getType();
        girlyDbBean.url = result.getUrl();
        girlyDbBean.used = result.getUsed();
        girlyDbBean.objectId = result.get_id();
        girlyDbBean.createdAt = result.getCreatedAt();
        girlyDbBean.save();
    }

}
 
Example 3
Source File: FunDao.java    From coderfun with GNU General Public License v3.0 6 votes vote down vote up
public static void addFun_Real(List<List<Results>> results) {
    Delete.table(RealDbBean.class);
    for (List<Results> result : results) {
        for (int i = 0; i < result.size(); i++) {
            RealDbBean realDbBean = new RealDbBean();
            realDbBean.who = result.get(i).getWho();
            realDbBean.publishedAt = result.get(i).getPublishedAt();
            realDbBean.desc = result.get(i).getDesc();
            realDbBean.type = result.get(i).getType();
            realDbBean.url = result.get(i).getUrl();
            realDbBean.used = result.get(i).getUsed();
            realDbBean.objectId = result.get(i).get_id();
            realDbBean.createdAt = result.get(i).getCreatedAt();
            realDbBean.save();
        }
    }

}
 
Example 4
Source File: MainActivity.java    From DBFlowManager with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.btnClearTable)
public void clearTable()
{
    if (radioGroup.getCheckedRadioButtonId() == R.id.radioUser)
    {
        Delete.table(UserModel.class);
        Snackbar.make(layoutMain, "User Table cleared in Database!", Snackbar.LENGTH_SHORT).show();
    }
    else if (radioGroup.getCheckedRadioButtonId() == R.id.radioCompany)
    {
        Delete.table(CompanyModel.class);
        Snackbar.make(layoutMain, "Company Table Cleared in Database!", Snackbar.LENGTH_SHORT).show();
    }
    updateCountText();
}
 
Example 5
Source File: DBFlowExecutor.java    From android-orm-benchmark-updated with Apache License 2.0 5 votes vote down vote up
@Override
public long dropDb() throws SQLException {
    long start = System.nanoTime();
    Delete.table(Message.class);
    Delete.table(User.class);
    return System.nanoTime() - start;
}
 
Example 6
Source File: PerfTestDbFlow.java    From android-database-performance with Apache License 2.0 5 votes vote down vote up
private void indexedStringEntityQueriesRun(int count) {
    // create entities
    List<IndexedStringEntity> entities = new ArrayList<>(count);
    String[] fixedRandomStrings = StringGenerator.createFixedRandomStrings(count);
    for (int i = 0; i < count; i++) {
        IndexedStringEntity entity = new IndexedStringEntity();
        entity._id = (long) i;
        entity.indexedString = fixedRandomStrings[i];
        entities.add(entity);
    }
    log("Built entities.");

    // insert entities
    FlowManager.getDatabase(FlowDatabase.class).executeTransaction(insertTransaction(entities, IndexedStringEntity.class));

    log("Inserted entities.");

    // query for entities by indexed string at random
    int[] randomIndices = StringGenerator.getFixedRandomIndices(getQueryCount(), count - 1);

    startClock();
    for (int i = 0; i < getQueryCount(); i++) {
        int nextIndex = randomIndices[i];

        //noinspection unused
        IndexedStringEntity indexedStringEntity = SQLite.select()
                .from(IndexedStringEntity.class)
                .where(IndexedStringEntity_Table.indexedString.eq(
                        fixedRandomStrings[nextIndex]))
                .querySingle();
    }
    stopClock(Benchmark.Type.QUERY_INDEXED);

    // delete all entities
    Delete.table(IndexedStringEntity.class);
    log("Deleted all entities.");
}
 
Example 7
Source File: PerfTestDbFlow.java    From android-database-performance with Apache License 2.0 4 votes vote down vote up
private void deleteAll() {
    Delete.table(SimpleEntityNotNull.class);
}
 
Example 8
Source File: ScroballDB.java    From scroball with MIT License 2 votes vote down vote up
/**
 * Clears all {@link PlaybackItem}s from the database. This method should be called when pending
 * items have been queued for re-submission.
 */
public void clearPendingPlaybackItems() {
  Delete.table(PendingPlaybackItemEntry.class);
}