Skip to content

Commit

Permalink
Merge pull request #1989 from moneymanagerex/replace2ignore
Browse files Browse the repository at this point in the history
CONFLICT_REPLACE to CONFLICT_IGNORE
  • Loading branch information
guanlisheng authored Dec 21, 2024
2 parents d8b00e8 + c9f2e74 commit 0aab1fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package com.money.manager.ex;

import static android.database.sqlite.SQLiteDatabase.CONFLICT_REPLACE;
import static android.database.sqlite.SQLiteDatabase.CONFLICT_IGNORE;

import android.content.ContentProvider;
import android.content.ContentValues;
Expand Down Expand Up @@ -169,7 +169,7 @@ public Uri insert(@NonNull Uri uri, ContentValues values) {
initializeDependencies();

id = openHelper.get().getWritableDatabase()
.insert(dataset.getSource(), CONFLICT_REPLACE, values);
.insert(dataset.getSource(), CONFLICT_IGNORE, values);
//database.setTransactionSuccessful();
} catch (Exception e) {
Timber.e(e, "inserting: %s", "insert");
Expand Down Expand Up @@ -203,7 +203,7 @@ public int update(@NonNull Uri uri, ContentValues values, String whereClause, St
logUpdate(dataset, values, whereClause, whereArgs);

try {
rowsUpdate = database.update(dataset.getSource(), CONFLICT_REPLACE, values, whereClause, whereArgs);
rowsUpdate = database.update(dataset.getSource(), CONFLICT_IGNORE, values, whereClause, whereArgs);
} catch (Exception ex) {
Timber.e(ex, "updating: %s", "update");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public void onClick(DialogInterface dialog, int which) {
switch (type) {
case INSERT:
Payee payee = service.createNew(name);
if (payee != null) {
if (payee != null && payee.getId() != null) {
// Created a new payee. But only if picking a payee for another activity.
if (mAction.equalsIgnoreCase(Intent.ACTION_PICK)) {
// Select it and close.
Expand Down

0 comments on commit 0aab1fd

Please sign in to comment.