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

The following examples show how to use com.raizlabs.android.dbflow.sql.language.Delete. These examples are extracted from open source projects. 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 Project: coderfun   Source File: FunDao.java    License: 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 Project: coderfun   Source File: FunDao.java    License: 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 Project: coderfun   Source File: FunDao.java    License: 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
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 Project: Stock-Hawk   Source File: DatabaseHelper.java    License: 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 Project: DBFlowManager   Source File: MainActivity.java    License: 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
@Override
public long dropDb() throws SQLException {
    long start = System.nanoTime();
    Delete.table(Message.class);
    Delete.table(User.class);
    return System.nanoTime() - start;
}
 
Example 8
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 Project: CSCI4669-Fall15-Android   Source File: DetailsFragment.java    License: 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 Project: scroball   Source File: ScroballDB.java    License: 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
private void deleteAll() {
    Delete.table(SimpleEntityNotNull.class);
}
 
Example 12
Source Project: scroball   Source File: ScroballDB.java    License: 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);
}