Hello,
I’ve been playing with PHP SDK, however I did found out something strange according to docs related to Named Parameters and SQL Injection: http://developer.couchbase.com/documentation/server/current/sdk/php/n1ql-queries-with-sdk.html
Using the examples in the docs, I am not being able to get named params to work. Modifying it a bit so suit my use case:
$query = CouchbaseN1qlQuery::fromString('select * from `users` where _type = "user_account" AND _id = "$user_account"');
$query->namedParams(['user_account' => 1]);
$result = $bucket->query($query);
(I am not using this query, it is just for exemplification purposes)
The previous query tries to mount “1” as the user_account, however it seems to always return no results at all. However, if I do it directly like the following:
$query = CouchbaseN1qlQuery::fromString('select * from `users` where _type = "user_account" AND _id = "1"');
$result = $bucket->query($query);
It seems to just work and return me the results I want. Positional parameters seem to behave equal.
Any ideas on what am I missing?
Thanks!