Executing a prepared statement in Couchbase


We have built a prepared statement and it works fine when executed via CURL.
It returns HTTP 200 OK
We are using : Community Edition 5.0.1 build 5003

curl -v http://localhost:8093/query/service -d ‘prepared=“testcustomerid”&$CustomerID=12345’ .
However we dont see any result set eventhough there are matching records present

“requestID”: “22112bf3-32f5-43b4-9a08-64ed7102a558”,
“signature”: {
": "
“results”: ,
“status”: “success”,
“metrics”: {
“elapsedTime”: “1.368362ms”,
“executionTime”: “1.309959ms”,
“resultCount”: 0,
“resultSize”: 0

Configured a test in JMeter and when triggering via JMeter receive the following error which is different from CURL

“requestID”: “c3c76ec8-9baf-462e-8c56-ce09a76a0a27”,
“errors”: [{“code”:3000,“msg”:“syntax error - at \u0026”}],
“status”: “fatal”,
“metrics”: {“elapsedTime”: “326.742µs”,“executionTime”: “271.382µs”,“resultCount”: 0,“resultSize”: 0,“errorCount”: 1}

What could be the issue , what are we missing here?

Request in JMeter looks like this:

POST http://localhost:8093/query/service

POST data:

[no cookies]
PS : JMeter test without a prepared statement and direct select works fine

not sure why you get error. You can post something like this.

curl -v http://localhost:8093/query/service -d 'statement=PREPARE p10 FROM SELECT f1, f2 from default  where f1 = $n1 and f3 = $n3'
curl -v http://localhost:8093/query/service -H "Content-Type: application/json"  -d '{"prepared":"p10", "$n1":3, "$n3":"doc03"}'

Thanks for your reply …same doesn’t help much. I still see an empty result set.

Any help in this context,is this a BUG? I see the same behavior on Couchbase 6.0 as well , i mean an empty result set on execution of a prepared statement

Unless you post whole statement not able to answer

Thank you …i figured it out…it was an issue with the quotes(’) ,thanks for your help