1
0
mirror of https://github.com/danog/postgres.git synced 2025-01-22 13:21:14 +01:00

Unset statement cache if prepare fails

This commit is contained in:
Aaron Piotrowski 2017-07-31 00:52:56 -05:00
parent 588d4ff4c6
commit b76ff0f5d9
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
2 changed files with 12 additions and 2 deletions

View File

@ -277,7 +277,12 @@ class PgSqlExecutor implements Executor {
// @codeCoverageIgnoreEnd
}
});
$storage->promise->onResolve(function () use ($storage) {
$storage->promise->onResolve(function ($exception) use ($storage, $name) {
if ($exception) {
unset($this->statements[$name]);
return;
}
$storage->promise = null;
});
return $storage->promise;

View File

@ -273,7 +273,12 @@ class PqExecutor implements Executor {
$storage->statement = $statement;
return new PqStatement($statement, $this->send, $this->deallocate);
});
$storage->promise->onResolve(function () use ($storage) {
$storage->promise->onResolve(function ($exception) use ($storage, $name) {
if ($exception) {
unset($this->statements[$name]);
return;
}
$storage->promise = null;
});
return $storage->promise;