Looking at the documentation at http://developer.couchbase.com/documentation/server/4.0/sdks/dotnet-2.2/prepared-statements.html, there is a way to use prepared statement.
How do I use a prepared statement in php SDK?
If it is not currently supported, what’s the best way to get around it?
$query = \CouchbaseN1qlQuery::fromString(‘SELECT * from default where type=$type LIMIT $length’);
$res = $bucket->query($query, array(‘type’ => $type, ‘length’ => (int)$length);
sorry for the delay in response.
That actually didn’t work for me. I tested it with very simple query.
$q = CouchbaseN1qlQuery::fromString(‘select * from mybucket LIMIT $length’);
$res = $bucket->query($q, [
‘length’ => 3,
I got “Unrecognized parameter in request: 0”
I removed couchbase sdk and then re-built it by cloning the master branch from github. It works as expected now.