diff --git a/examples/protocol/execute.php b/examples/protocol/execute.php index c523275..36d30d8 100644 --- a/examples/protocol/execute.php +++ b/examples/protocol/execute.php @@ -35,8 +35,10 @@ * It was introduced in Tarantool 2.11.0-rc1. If compat.sql_seq_scan_default set to "new" * (default value since 3.0), query returns error when trying to scan without keyword. */ -$seqScan = server_version_at_least('2.11.0-rc1', $client) ? 'SEQSCAN' : ''; -$result3 = $client->executeQuery("SELECT * FROM $seqScan users WHERE \"email\" = ?", 'foo@example.com'); +$scanQuery = server_version_at_least('2.11.0-rc1', $client) + ? 'SELECT * FROM SEQSCAN users WHERE "email" = ?' + : 'SELECT * FROM users WHERE "email" = ?'; +$result3 = $client->executeQuery($scanQuery, 'foo@example.com'); $result4 = $client->executeQuery('SELECT * FROM users WHERE "id" IN (?, ?)', 1, 2); diff --git a/examples/protocol/prepare.php b/examples/protocol/prepare.php index c379ac4..39eaabb 100644 --- a/examples/protocol/prepare.php +++ b/examples/protocol/prepare.php @@ -33,8 +33,10 @@ * It was introduced in Tarantool 2.11.0-rc1. If compat.sql_seq_scan_default set to "new" * (default value since 3.0), query returns error when trying to scan without keyword. */ -$seqScan = server_version_at_least('2.11.0-rc1', $client) ? 'SEQSCAN' : ''; -$result = $client->executeQuery("SELECT COUNT(\"id\") AS \"cnt\" FROM $seqScan users"); +$scanQuery = server_version_at_least('2.11.0-rc1', $client) + ? 'SELECT COUNT("id") AS "cnt" FROM SEQSCAN users' + : 'SELECT COUNT("id") AS "cnt" FROM users'; +$result = $client->executeQuery($scanQuery); printf("Result: %s\n", json_encode($result[0]));