Example usage for android.database.sqlite SQLiteDatabase delete

List of usage examples for android.database.sqlite SQLiteDatabase delete

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteDatabase delete.

Prototype

public int delete(String table, String whereClause, String[] whereArgs) 

Source Link

Document

Convenience method for deleting rows in the database.

Usage

From source file:com.rener.sea.DBHelper.java

private long deleteOption(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;//from w  w  w  .j av  a 2  s  .co  m
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            db.delete(DBSchema.TABLE_OPTION, DBSchema.OPTION_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.OPTION_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteUsers_specialization(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/* w  w w.  j a  v  a2  s  . co m*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            db.delete(DBSchema.TABLE_USERS_SPECIALIZATION,
                    DBSchema.USERS_SPECIALIZATION_SPECIALIZATION_ID + " =? AND "
                            + DBSchema.USERS_SPECIALIZATION_USER_ID + " =? ",
                    new String[] {
                            String.valueOf(item.getLong(DBSchema.USERS_SPECIALIZATION_SPECIALIZATION_ID)),
                            String.valueOf(item.getLong(DBSchema.USERS_SPECIALIZATION_USER_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteItem(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/*  www .  jav  a  2 s.c o m*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_ITEM, DBSchema.ITEM_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.ITEM_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deletePath(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/* ww w .j  a va2  s . c  o m*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_PATH, DBSchema.PATH_REPORT_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.PATH_REPORT_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteSpecialization(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/* w w w.  j a v  a2  s.co m*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_SPECIALIZATION, DBSchema.SPECIALIZATION_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.SPECIALIZATION_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deletePerson(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/*from  w  ww.ja  va  2 s  .c om*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_PERSON, DBSchema.PERSON_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.PERSON_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteAppointments(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/*from   w  ww. j  av  a2 s.  c om*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_APPOINTMENTS, DBSchema.APPOINTMENT_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.APPOINTMENT_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteAddress(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;/*from   w w  w. jav  a  2 s.co m*/
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_ADDRESS, DBSchema.ADDRESS_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.ADDRESS_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteCategory(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;//from w  w w .  j a v a  2s  .com
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_CATEGORY, DBSchema.CATEGORY_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.CATEGORY_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}

From source file:com.rener.sea.DBHelper.java

private long deleteLocation(JSONArray data) {
    SQLiteDatabase db = this.getWritableDatabase();
    int i = -1;//ww w.  j  av a 2s. c om
    try {
        for (i = 0; i < data.length(); i++) {
            JSONObject item = data.getJSONObject(i);
            long id = db.delete(DBSchema.TABLE_LOCATION, DBSchema.LOCATION_ID + "=?",
                    new String[] { String.valueOf(item.getLong(DBSchema.LOCATION_ID)) });
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    db.close();
    return i;
}