com.raizlabs.android.dbflow.sql.language.Delete Java Examples

The following examples show how to use com.raizlabs.android.dbflow.sql.language.Delete. 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: UserController.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void logOut() {
    LastUpdatedManager.getInstance().delete();
    DateTimeManager.getInstance().delete();
    SessionManager.getInstance().delete();

    // remove data
    Delete.tables(
            Dashboard.class,
            DashboardElement.class,
            DashboardItem.class,
            DashboardItemContent.class,
            Interpretation.class,
            InterpretationComment.class,
            InterpretationElement.class,
            User.class,
            UserAccount.class
    );
}
 
Example #5
Source File: DatabaseHelper.java    From Stock-Hawk with Apache License 2.0 5 votes vote down vote up
public Observable<Stocks> deleteStock(final String symbol) {
    return Observable.defer(new Func0<Observable<Stocks>>() {
        @Override
        public Observable<Stocks> call() {

            Delete.table(Quote.class,
                    Quote_Table.msymbol.eq(symbol));

            return getStocks();
        }
    });
}
 
Example #6
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 #7
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 #8
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 #9
Source File: DetailsFragment.java    From CSCI4669-Fall15-Android with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle bundle)
{
   // create a new AlertDialog Builder
   AlertDialog.Builder builder = 
      new AlertDialog.Builder(getActivity());
      
   builder.setTitle(R.string.confirm_title); 
   builder.setMessage(R.string.confirm_message);
      
   // provide an OK button that simply dismisses the dialog
   builder.setPositiveButton(R.string.button_delete,
      new DialogInterface.OnClickListener()
      {
         @Override
         public void onClick(
            DialogInterface dialog, int button)
         {

            new Delete().from(Contact.class).where("id = ?", String.valueOf(rowID)).query();

            listener.onContactDeleted();
         } // end method onClick
      } // end anonymous inner class
   ); // end call to method setPositiveButton
   
   builder.setNegativeButton(R.string.button_cancel, null);
   return builder.create(); // return the AlertDialog
}
 
Example #10
Source File: ScroballDB.java    From scroball with MIT License 4 votes vote down vote up
/** Clears all {@link Scrobble} and {@link PlaybackItem}s from the database. */
public void clear() {
  Delete.tables(ScrobbleLogEntry.class, PendingPlaybackItemEntry.class);
}
 
Example #11
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 #12
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);
}