mirror of
https://github.com/danog/postgres.git
synced 2025-01-22 05:11:14 +01:00
Fixes the issue where the prepared statement's plan_name is truncated
This commit is contained in:
parent
8e37f2aaa6
commit
08e3432995
@ -205,7 +205,7 @@ class PgSqlExecutor implements Executor {
|
||||
*/
|
||||
public function execute(string $sql, ...$params): Promise {
|
||||
return call(function () use ($sql, $params) {
|
||||
return $this->createResult(yield from $this->send("pg_send_query_params", $sql, $params));
|
||||
return $this->createResult(yield from $this->send("pg_send_query_params", sha1($sql), $params));
|
||||
});
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ class PgSqlExecutor implements Executor {
|
||||
*/
|
||||
public function prepare(string $sql): Promise {
|
||||
return call(function () use ($sql) {
|
||||
yield from $this->send("pg_send_prepare", $sql, $sql);
|
||||
yield from $this->send("pg_send_prepare", sha1($sql), $sql);
|
||||
return new PgSqlStatement($sql, $this->executeCallback);
|
||||
});
|
||||
}
|
||||
|
@ -35,6 +35,6 @@ class PgSqlStatement implements Statement {
|
||||
* @throws \Amp\Postgres\FailureException If executing the statement fails.
|
||||
*/
|
||||
public function execute(...$params): Promise {
|
||||
return ($this->execute)($this->sql, $params);
|
||||
return ($this->execute)(sha1($this->sql), $params);
|
||||
}
|
||||
}
|
||||
|
@ -215,14 +215,14 @@ class PqExecutor implements Executor {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute(string $sql, ...$params): Promise {
|
||||
return new Coroutine($this->send([$this->handle, "execParamsAsync"], $sql, $params));
|
||||
return new Coroutine($this->send([$this->handle, "execParamsAsync"], sha1($sql), $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare(string $sql): Promise {
|
||||
return new Coroutine($this->send([$this->handle, "prepareAsync"], $sql, $sql));
|
||||
return new Coroutine($this->send([$this->handle, "prepareAsync"], sha1($sql), $sql));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user