1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-30 04:29:12 +01:00

Increase ref-count before waiting

This commit is contained in:
Aaron Piotrowski 2019-09-26 17:27:22 -05:00
parent b056da210d
commit 170266227a
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
2 changed files with 4 additions and 4 deletions

View File

@ -372,13 +372,13 @@ final class PgSqlHandle implements Handle
if (isset($this->statements[$name])) { if (isset($this->statements[$name])) {
$storage = $this->statements[$name]; $storage = $this->statements[$name];
++$storage->refCount;
if ($storage->promise instanceof Promise) { if ($storage->promise instanceof Promise) {
// Do not return promised prepared statement object, as the $names array may differ. // Do not return promised prepared statement object, as the $names array may differ.
yield $storage->promise; yield $storage->promise;
} }
++$storage->refCount;
return new PgSqlStatement($this, $name, $sql, $names); return new PgSqlStatement($this, $name, $sql, $names);
} }

View File

@ -393,13 +393,13 @@ final class PqHandle implements Handle
if (isset($this->statements[$name])) { if (isset($this->statements[$name])) {
$storage = $this->statements[$name]; $storage = $this->statements[$name];
++$storage->refCount;
if ($storage->promise instanceof Promise) { if ($storage->promise instanceof Promise) {
// Do not return promised prepared statement object, as the $names array may differ. // Do not return promised prepared statement object, as the $names array may differ.
yield $storage->promise; yield $storage->promise;
} }
++$storage->refCount;
return new PqStatement($this, $name, $sql, $names); return new PqStatement($this, $name, $sql, $names);
} }