diff --git a/lib/PgSqlExecutor.php b/lib/PgSqlExecutor.php index 70c7d29..6a5e191 100644 --- a/lib/PgSqlExecutor.php +++ b/lib/PgSqlExecutor.php @@ -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); }); } diff --git a/lib/PgSqlStatement.php b/lib/PgSqlStatement.php index bd32d11..93687ab 100644 --- a/lib/PgSqlStatement.php +++ b/lib/PgSqlStatement.php @@ -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); } } diff --git a/lib/PqExecutor.php b/lib/PqExecutor.php index c5d5190..28193c3 100644 --- a/lib/PqExecutor.php +++ b/lib/PqExecutor.php @@ -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)); } /**