jenkins-bot has submitted this change and it was merged.
Change subject: Fix Reading List page list membership queries
......................................................................
Fix Reading List page list membership queries
List memberships are preserved as a CSV:
key,key,key
An empty lists mean delete and should never exist in the database and a
list of one has no commas:
key
In practice, a list of three keys looks like:
ABCDEF,ABCDEFjsAdifj,SDFpodskfposk
The prior implementation intended to perform a substring query on the
CSV where the query was wrapped in delimiters to restrict matches to
whole keys and prevent portions of keys matching. In the above example,
a match for the ABCDEF key should match the first item but not the
second, which only happens to contain ABCDEF as a substring. The query
looks like:
%,ABCDEF,%
Since the first and last items of the key list won't be delimited on
both sides, the column contents should pre and postfixed with commas.
The prior implementation was confused and broken.
Change-Id: I4605e0e1d37aae873d171d637bea43467eec77b6
---
M
app/src/main/java/org/wikipedia/readinglist/page/database/ReadingListPageDao.java
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Dbrant: Looks good to me, approved
jenkins-bot: Verified
diff --git
a/app/src/main/java/org/wikipedia/readinglist/page/database/ReadingListPageDao.java
b/app/src/main/java/org/wikipedia/readinglist/page/database/ReadingListPageDao.java
index da435de..e7b7ca1 100644
---
a/app/src/main/java/org/wikipedia/readinglist/page/database/ReadingListPageDao.java
+++
b/app/src/main/java/org/wikipedia/readinglist/page/database/ReadingListPageDao.java
@@ -135,8 +135,8 @@
private static final String SELECT_ROWS_WITH_KEY = ":keyCol == ?"
.replaceAll(":keyCol",
ReadingListPageContract.Page.KEY.qualifiedName());
- private static final String SELECT_ROWS_WITH_LIST_KEY = ":listKeyCol
== ',' || ? || ','"
- .replaceAll(":listKeyCol",
ReadingListPageContract.Page.LIST_KEYS.qualifiedName());
+ private static final String SELECT_ROWS_WITH_LIST_KEY = "',' ||
:listKeyCol || ',' like '%,' || ? || ',%'"
+ .replaceAll(":listKeyCol",
ReadingListPageContract.Page.LIST_KEYS.qualifiedName());
private static String SELECT_ROWS_PENDING_DISK_TRANSACTION =
":transactionIdCol == :noTransactionId"
.replaceAll(":transactionIdCol",
ReadingListPageContract.DiskWithPage.DISK_TRANSACTION_ID.qualifiedName())
--
To view, visit https://gerrit.wikimedia.org/r/285303
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4605e0e1d37aae873d171d637bea43467eec77b6
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits