Fixed issue with #n1ql.bucket evaluated as collection name in string based queries. (#1804)
Closes #1799
This commit is contained in:
committed by
mikereiche
parent
2a4aa5ed7b
commit
9b1cd645ac
@@ -62,6 +62,7 @@ import com.couchbase.client.java.json.JsonValue;
|
||||
/**
|
||||
* @author Subhashni Balakrishnan
|
||||
* @author Michael Reiche
|
||||
* @author Tigran Babloyan
|
||||
*/
|
||||
public class StringBasedN1qlQueryParser {
|
||||
public static final String SPEL_PREFIX = "n1ql";
|
||||
@@ -166,7 +167,7 @@ public class StringBasedN1qlQueryParser {
|
||||
this.queryMethod = queryMethod;
|
||||
this.couchbaseConverter = couchbaseConverter;
|
||||
this.statementContext = queryMethod == null ? null
|
||||
: createN1qlSpelValues(collection != null ? collection : bucketName, scope, collection,
|
||||
: createN1qlSpelValues(bucketName, scope, collection,
|
||||
queryMethod.getEntityInformation().getJavaType(), typeField, typeValue, queryMethod.isCountQuery(), null, null);
|
||||
this.parsedExpression = getExpression(statement, queryMethod, accessor, spelExpressionParser,
|
||||
evaluationContextProvider);
|
||||
|
||||
@@ -208,7 +208,7 @@ class StringN1qlQueryCreatorTests {
|
||||
|
||||
assertEquals("SELECT `_class`, `jsonNode`, `jsonObject`, `jsonArray`, META(`myCollection`).`cas`"
|
||||
+ " AS __cas, `createdBy`, `createdDate`, `lastModifiedBy`, `lastModifiedDate`, META(`myCollection`).`id`"
|
||||
+ " AS __id, `firstname`, `lastname`, `subtype` FROM `myCollection`|`_class` = \"abstractuser\"|`myCollection`|`myScope`|`myCollection`",
|
||||
+ " AS __id, `firstname`, `lastname`, `subtype` FROM `myCollection`|`_class` = \"abstractuser\"|`some_bucket`|`myScope`|`myCollection`",
|
||||
query.toN1qlSelectString(converter, bucketName(), "myScope", "myCollection", User.class, null, false, null,
|
||||
null));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user