From: Damyan Ivanov Date: Fri, 27 Aug 2021 20:13:04 +0000 (+0000) Subject: include description_uc in Transaction's SQL X-Git-Tag: v0.20.1~10 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;ds=inline;h=ae9662763de5fb184a43c475113ffb3b9a50482a;p=mobile-ledger.git include description_uc in Transaction's SQL --- diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java index 4032602c..fca54eda 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java @@ -17,7 +17,6 @@ package net.ktnx.mobileledger.dao; - import androidx.annotation.NonNull; import androidx.lifecycle.LiveData; import androidx.room.ColumnInfo; @@ -91,9 +90,9 @@ public abstract class TransactionDAO extends BaseDAO { public abstract TransactionWithAccounts getFirstByDescriptionSync(@NonNull String description); @androidx.room.Transaction - @Query("SELECT tr.id, tr.profile_id, tr.ledger_id, tr.description, tr.data_hash, tr.comment, " + - "tr.year, tr.month, tr.day, tr.generation from transactions tr JOIN " + - "transaction_accounts t_a ON t_a.transaction_id = tr.id WHERE tr.description = " + + @Query("SELECT tr.id, tr.profile_id, tr.ledger_id, tr.description, tr.description_uc, tr" + + ".data_hash, tr.comment, tr.year, tr.month, tr.day, tr.generation from transactions tr" + + " JOIN transaction_accounts t_a ON t_a.transaction_id = tr.id WHERE tr.description = " + ":description AND t_a.account_name LIKE '%'||:accountTerm||'%' ORDER BY year desc, " + "month desc, day desc, tr.ledger_id desc LIMIT 1") public abstract TransactionWithAccounts getFirstByDescriptionHavingAccountSync( @@ -112,10 +111,10 @@ public abstract class TransactionDAO extends BaseDAO { @androidx.room.Transaction @Query("SELECT distinct(tr.id), tr.ledger_id, tr.profile_id, tr.data_hash, tr.year, tr.month," + - " tr.day, tr.description, tr.comment, tr.generation FROM transactions tr JOIN " + - "transaction_accounts ta ON ta.transaction_id=tr.id WHERE ta.account_name LIKE " + - ":accountName||'%' AND ta.amount <> 0 AND tr.profile_id = :profileId ORDER BY tr.year " + - "asc, tr.month asc, tr.day asc, tr.ledger_id asc") + " tr.day, tr.description, tr.description_uc, tr.comment, tr.generation FROM " + + "transactions tr JOIN transaction_accounts ta ON ta.transaction_id=tr.id WHERE ta" + + ".account_name LIKE :accountName||'%' AND ta.amount <> 0 AND tr.profile_id = " + + ":profileId ORDER BY tr.year asc, tr.month asc, tr.day asc, tr.ledger_id asc") public abstract LiveData> getAllWithAccountsFiltered( long profileId, String accountName);