Hello guys,
I am totally new to couchbase, so help me if there anything wrong I did.
I’m using C-SDK (2.5.7 64-bit) and PHP-SDK (2.0.0) to populate data in/from Couchbase server.
Note:- [I’m using **RHEL** server **6.x** and **PHP 5.6.12**. Due to network security I’m unable to install directly using ‘**wget**’ or ‘**PECL**’ command. So I download the **C-SDK** zip and install all the rpm files and then I installl the **PHP-SDK** by downloading the source file and compile it manually.]
The code is working fine for basic CRUD operation using get,insert,update functions. But it’s unable to work when I’m trying to execute N1QL query.
The php code I’m using to achieve this is as follow:-
try {
$myCluster= new CouchbaseCluster("http://X.X.X.X");
$myBucket = $myCluster->openBucket("default");
$query = CouchbaseN1qlQuery::fromString("SELECT * FROM default");
$res = $myBucket->query($query);
}catch(CouchbaseException $e){
print_r($e);
}
Now I’m getting exception with detail message like this :-
CouchbaseException Object
(
[message:protected] => adhoc must be a bool
[string:Exception:private] =>
[code:protected] => 7
[file:protected] => [CouchbaseNative]/CouchbaseBucket.class.php
[line:protected] => 313
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => [CouchbaseNative]/CouchbaseBucket.class.php
[line] => 313
[function] => n1ql_request
[class] => _CouchbaseBucket
[type] => ->
[args] => Array
(
[0] => {"statement":"SELECT * FROM default"}
[1] => 1
)
)
[1] => Array
(
[file] => [CouchbaseNative]/CouchbaseBucket.class.php
[line] => 342
[function] => _n1ql
[class] => CouchbaseBucket
[type] => ->
[args] => Array
(
[0] => CouchbaseN1qlQuery Object
(
[options] => Array
(
[statement] => SELECT * FROM default
)
[adhoc] => 1
)
[1] =>
[2] =>
)
)
[2] => Array
(
[file] => /home/super/phpsqltest.php
[line] => 8
[function] => query
[class] => CouchbaseBucket
[type] => ->
[args] => Array
(
[0] => CouchbaseN1qlQuery Object
(
[options] => Array
(
[statement] => SELECT * FROM default
)
[adhoc] => 1
)
)
)
)
[previous:Exception:private] =>
)
Please help…