]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java
move async DB stuff away of AsyncTask
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / dao / TransactionDAO.java
index 9d7fdeae4813171c7a697065c59ce2016435f843..4032602c741abe4bd97396ead3535809315fb337 100644 (file)
@@ -17,7 +17,6 @@
 
 package net.ktnx.mobileledger.dao;
 
-import android.os.AsyncTask;
 
 import androidx.annotation.NonNull;
 import androidx.lifecycle.LiveData;
@@ -79,11 +78,11 @@ public abstract class TransactionDAO extends BaseDAO<Transaction> {
     @Query("SELECT * FROM transactions WHERE id = :transactionId")
     public abstract TransactionWithAccounts getByIdWithAccountsSync(long transactionId);
 
-    @Query("SELECT DISTINCT description, CASE WHEN description LIKE :term||'%%' THEN 1 " +
-           "               WHEN description LIKE '%%:'||:term||'%%' THEN 2 " +
-           "               WHEN description LIKE '%% '||:term||'%%' THEN 3 " +
+    @Query("SELECT DISTINCT description, CASE WHEN description_uc LIKE :term||'%%' THEN 1 " +
+           "               WHEN description_uc LIKE '%%:'||:term||'%%' THEN 2 " +
+           "               WHEN description_uc LIKE '%% '||:term||'%%' THEN 3 " +
            "               ELSE 9 END AS ordering FROM transactions " +
-           "WHERE description LIKE '%%'||:term||'%%' " + "ORDER BY ordering, description, rowid ")
+           "WHERE description_uc LIKE '%%'||:term||'%%' ORDER BY ordering, description_uc, rowid ")
     public abstract List<DescriptionContainer> lookupDescriptionSync(@NonNull String term);
 
     @androidx.room.Transaction
@@ -217,7 +216,7 @@ public abstract class TransactionDAO extends BaseDAO<Transaction> {
         }
     }
     public void storeLast(TransactionWithAccounts rec) {
-        AsyncTask.execute(() -> appendSync(rec));
+        BaseDAO.runAsync(() -> appendSync(rec));
     }
     @androidx.room.Transaction
     public void appendSync(TransactionWithAccounts rec) {