You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/09/25 14:04:28 UTC
(jackrabbit-oak) 01/01: OAK-11146: RDBDocumentStore should handle queries with '>' condition on 0x00
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-11146
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 5b8fd6138f1f61b3196003b2c6f76c4042439a79
Author: Julian Reschke <re...@apache.org>
AuthorDate: Wed Sep 25 15:04:03 2024 +0100
OAK-11146: RDBDocumentStore should handle queries with '>' condition on 0x00
---
.../oak/plugins/document/rdb/RDBDocumentStoreJDBC.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
index 3ee5e58f71..cb706c3f87 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
@@ -732,7 +732,7 @@ public class RDBDocumentStoreJDBC {
PreparedStatement stmt = connection.prepareStatement(query.toString());
int si = 1;
- if (minId != null) {
+ if (shouldSkipGreaterthanClauseForId(minId)) {
setIdInStatement(tmd, stmt, si++, minId);
}
if (maxId != null) {
@@ -982,11 +982,17 @@ public class RDBDocumentStoreJDBC {
SUPPORTED_OPS = Collections.unmodifiableSet(tmp);
}
+ // some DBs do not accept null character as string
+ private static boolean shouldSkipGreaterthanClauseForId(String id) {
+ return id != null && !"\u0000".equals(id);
+ }
+
private static String buildWhereClause(String minId, String maxId, List<String> excludeKeyPatterns, List<QueryCondition> conditions) {
StringBuilder result = new StringBuilder();
String whereSep = "";
- if (minId != null) {
+
+ if (shouldSkipGreaterthanClauseForId(minId)) {
result.append("ID > ?");
whereSep = " and ";
}