我想使用參數化的N1QL查詢,但它不識別json佔位符並拋出不正確的語法異常。N1QL查詢不識別參數
代碼:
public static final String LMR_DETAILS
= "SELECT * FROM $bucketName WHERE lmr.lmrStatusDescriptionTe ='PENDING'and STR_TO_MILLIS(lmr.recordExpirationTs) BETWEEN STR_TO_MILLIS($startTime) AND STR_TO_MILLIS($endTime)";
String bucketName = bucket.bucketManager().info().name();
JsonObject placeHolders = JsonObject.create().put("bucketName", bucketName).put("startTime", reqDates[0]).put("endTime", reqDates[1]);
N1qlQuery query = N1qlQuery.parameterized(QueryString.LMR_DETAILS, placeHolders);
N1qlQueryResult result = bucket.query(query);
FROM子句後面的存儲桶名稱不能被參數化。 – vsr