Closed PNixx closed 11 months ago
amphp/sql-common: v2.0.0-beta.7 amphp/postgres: v2.0.0-beta.5 amphp/sql: v2.0.0-beta.6
Example:
use Amp\Postgres; use Amp\Postgres\PostgresConfig; require 'vendor/autoload.php'; $config = new PostgresConfig('localhost', 5432, 'user', 'pass', 'dbtest'); $connection = Postgres\connect($config); $transaction = $connection->beginTransaction(); $result = $transaction->execute('INSERT INTO customers (email,time_zone) VALUES (:email,:time_zone) RETURNING *', [ 'email' => 'test@test.com', 'time_zone' => 'UTC', ]); print_r($result->fetchRow()); $result = $transaction->execute('INSERT INTO customers (email) VALUES (:email) RETURNING *', [ 'email' => 'test2@test.com', ]); // <---- suspend here print_r($result->fetchRow()); $transaction->rollback();
STDOUT:
Array ( [email] => test@test.com [time_zone] => UTC )
Works correctly if request similar sql queries:
use Amp\Postgres; use Amp\Postgres\PostgresConfig; require 'vendor/autoload.php'; $config = new PostgresConfig('localhost', 5432, 'user', 'pass', 'dbtest'); $connection = Postgres\connect($config); $transaction = $connection->beginTransaction(); $result = $transaction->execute('INSERT INTO customers (email,time_zone) VALUES (:email,:time_zone) RETURNING *', [ 'email' => 'test@test.com', 'time_zone' => 'UTC', ]); print_r($result->fetchRow()); $result = $transaction->execute('INSERT INTO customers (email,time_zone) VALUES (:email,:time_zone) RETURNING *', [ 'email' => 'test2@test.com', 'time_zone' => 'UTC', ]); print_r($result->fetchRow()); $transaction->rollback();
Array ( [email] => test@test.com [time_zone] => UTC ) Array ( [email] => test2@test.com [time_zone] => UTC )
In v2.0.0-beta.4 works correctly.
This should be fixed by amphp/sql-common@v2.0.0-beta.8.
amphp/sql-common@v2.0.0-beta.8
Example:
STDOUT:
Works correctly if request similar sql queries:
STDOUT:
In v2.0.0-beta.4 works correctly.