Commit d2ff4ab5 authored by Roberta's avatar Roberta

needs cleanup

parent 79ead07d
......@@ -87,14 +87,18 @@ public abstract class ContentProviderBase extends ContentProvider {
final SQLiteDatabase db = dbHelper.getWritableDatabase(GlobalObjectRegistry.getObject(ESCredentials.class).getUserHandle());
final MatchType matchType = codeToModel(matcher.match(uri));
final DBModel dmb = matchType.getModel();
final long rowID = db.insertOrThrow(dmb.getTableName(), null, values);
if (rowID == -1) {
throw new SQLException("Insert failed");
try {
final long rowID = db.insertOrThrow(dmb.getTableName(), null, values);
if (rowID == -1) {
throw new SQLException("Insert failed");
}
final Uri insertedRowURI = ContentUris.withAppendedId(EncounterHistoryAPM.getContentURI(dmb), rowID);
getContext().getContentResolver().notifyChange(insertedRowURI, null);
return insertedRowURI;
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
final Uri insertedRowURI = ContentUris.withAppendedId(EncounterHistoryAPM.getContentURI(dmb), rowID);
getContext().getContentResolver().notifyChange(insertedRowURI, null);
//Log.d(TAG, "Insert done");
return insertedRowURI;
return null;
}
public String addPKIDConditionToWhereClause(final String where, final String pkidString) { // TODO add to whereArgs instead
......
......@@ -99,7 +99,7 @@ public class EncounterEntriesBridge extends AbstractEncountersBridge<MEncounterE
values.put(PEncounterEntries.Columns.userHandle, userHandle);
try {
context.getContentResolver().insert(EncounterHistoryAPM.getContentURI(EncounterHistoryAPM.encounterEntries), values);
} catch (SQLiteConstraintException e) {
} catch (Exception e) {
Log.d(TAG, "Duplicate insert attempted");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment