1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-01 11:50:15 +02:00

PostgreSQL driver: escaping of save point name (#383)

This commit is contained in:
Jan Kuchař
2020-12-31 18:50:28 +01:00
committed by David Grudl
parent e046935137
commit 304af5185d

View File

@@ -188,7 +188,7 @@ class PostgreDriver implements Dibi\Driver
*/
public function begin(string $savepoint = null): void
{
$this->query($savepoint ? "SAVEPOINT $savepoint" : 'START TRANSACTION');
$this->query($savepoint ? "SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'START TRANSACTION');
}
@@ -198,7 +198,7 @@ class PostgreDriver implements Dibi\Driver
*/
public function commit(string $savepoint = null): void
{
$this->query($savepoint ? "RELEASE SAVEPOINT $savepoint" : 'COMMIT');
$this->query($savepoint ? "RELEASE SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'COMMIT');
}
@@ -208,7 +208,7 @@ class PostgreDriver implements Dibi\Driver
*/
public function rollback(string $savepoint = null): void
{
$this->query($savepoint ? "ROLLBACK TO SAVEPOINT $savepoint" : 'ROLLBACK');
$this->query($savepoint ? "ROLLBACK TO SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'ROLLBACK');
}