use of android.database.SQLException in project cw-omnibus by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project cw-advandroid by commonsguy.
the class Provider method insert.
@Override
public Uri insert(Uri url, ContentValues initialValues) {
long rowID = db.getWritableDatabase().insert(TABLE, Constants.TITLE, initialValues);
if (rowID > 0) {
Uri uri = ContentUris.withAppendedId(Provider.Constants.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(uri, null);
return (uri);
}
throw new SQLException("Failed to insert row into " + url);
}
use of android.database.SQLException in project DBFlow by Raizlabs.
the class AndroidDatabaseStatement method executeUpdateDelete.
@Override
public long executeUpdateDelete() {
long count = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
count = statement.executeUpdateDelete();
} else {
statement.execute();
Cursor cursor = null;
try {
cursor = database.rawQuery("SELECT changes() AS affected_row_count", null);
if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
count = cursor.getLong(cursor.getColumnIndex("affected_row_count"));
}
} catch (SQLException e) {
// Handle exception here.
} finally {
if (cursor != null) {
cursor.close();
}
}
}
return count;
}
Aggregations