I'm using PHP Client API for work with SQL (intensive)
But I've a problem.
In my first few unit tests, I was using a simple named index.
My surprise has been when trying to do the integration tests, when I took it out I already use aliases, like testing-analyzers
A query like this throws an exception
SELECT vac1_v,vac2_v,vac_v FROM test-analyzers WHERE id = 1 AND (vac1_v > 260 OR vac2_v > 260 OR vac3_v > 260)
$sql = ‘SELECT vac1_v,vac2_v,vac_v FROM test-analyzers WHERE id = 1 AND (vac1_v > 260 OR vac2_v > 260 OR vac3_v > 260)’
// Also try escaping the script -
// $sql = ‘SELECT vac1_v,vac2_v,vac_v FROM test\-analyzers WHERE id = 1 AND (vac1_v > 260 OR vac2_v > 260 OR vac3_v > 260)’
$params = [
'body' => [
"query" => $sql
]
];
//params: [▼
// "body" => array:1 [▼
// "query" => "SELECT vac1_v,vac2_v,vac_v FROM test\-analyzers WHERE id = 1 AND //(vac1_v > 260 OR vac2_v > 260 OR vac3_v > 260)"
// ]
$response = $client->sql()->query($params);
Mistake
400 Bad Request: {"error":{"root_cause":[{"type":"parsing_exception","reason":"line 1:37: mismatched input '\' expecting {,
"type":"parsing_exception","reason":"line 1:37: mismatched input '-' expecting {,
Any ideas?