From efeb51ced7fa9b4ef9fd50c88f0d72e4d3eb12d6 Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Thu, 13 Jan 2022 23:25:24 +0100 Subject: [PATCH] Update: Replace top with limit --- src/main/kotlin/com/looker/droidify/database/DAOs.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/looker/droidify/database/DAOs.kt b/src/main/kotlin/com/looker/droidify/database/DAOs.kt index 9ed20d0d..a5afc319 100644 --- a/src/main/kotlin/com/looker/droidify/database/DAOs.kt +++ b/src/main/kotlin/com/looker/droidify/database/DAOs.kt @@ -189,7 +189,7 @@ interface ProductDao : BaseDao { product.${ROW_SIGNATURES} LIKE ('%.' || installed.${ROW_SIGNATURE} || '.%') AND product.${ROW_SIGNATURES} != ''""" - builder += """SELECT ${if (numberOfItems > 0) "TOP $numberOfItems " else ""}product.rowid AS _id, product.${ROW_REPOSITORY_ID}, + builder += """SELECT product.rowid AS _id, product.${ROW_REPOSITORY_ID}, product.${ROW_PACKAGE_NAME}, product.${ROW_NAME}, product.${ROW_SUMMARY}, installed.${ROW_VERSION}, (COALESCE(lock.${ROW_VERSION_CODE}, -1) NOT IN (0, product.${ROW_VERSION_CODE}) AND @@ -258,7 +258,7 @@ interface ProductDao : BaseDao { ProductItem.Order.DATE_ADDED -> builder += "product.${ROW_ADDED} DESC," ProductItem.Order.LAST_UPDATE -> builder += "product.${ROW_UPDATED} DESC," }::class - builder += "product.${ROW_NAME} COLLATE LOCALIZED ASC" + builder += "product.${ROW_NAME} COLLATE LOCALIZED ASC${if (numberOfItems > 0) " LIMIT $numberOfItems" else ""}" return queryList(SimpleSQLiteQuery(builder.build())) }