List of usage examples for android.database.sqlite SQLiteConstraintException SQLiteConstraintException
public SQLiteConstraintException(String error)
From source file:android.database.DatabaseUtils.java
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) { switch (code) { case 2:// www. j a v a2 s . c om throw new IllegalArgumentException(msg); case 3: throw new UnsupportedOperationException(msg); case 4: throw new SQLiteAbortException(msg); case 5: throw new SQLiteConstraintException(msg); case 6: throw new SQLiteDatabaseCorruptException(msg); case 7: throw new SQLiteFullException(msg); case 8: throw new SQLiteDiskIOException(msg); case 9: throw new SQLiteException(msg); default: reply.readException(code, msg); } }
From source file:com.appsimobile.appsii.module.home.provider.HomeContentProvider.java
@Override public int delete(Uri uri, String selection, String[] selectionArgs) { SqlArguments args = new SqlArguments(uri, selection, selectionArgs); SQLiteDatabase db = mOpenHelper.getWritableDatabase(); try {//from ww w. j a va 2s .co m int count = db.delete(args.table, args.where, args.args); if (count > 0) sendNotify(uri); return count; } catch (SQLiteConstraintException e) { SQLiteConstraintException ex = new SQLiteConstraintException( "Constraint violation on delete of: " + uri); ex.initCause(e); throw ex; } }