Skip to content

Commit

Permalink
PostgreSQL driver: escaping of save point name (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuchar authored and dg committed Feb 5, 2021
1 parent e046935 commit 304af51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Dibi/Drivers/PostgreDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function getInsertId(?string $sequence): ?int
*/
public function begin(string $savepoint = null): void
{
$this->query($savepoint ? "SAVEPOINT $savepoint" : 'START TRANSACTION');
$this->query($savepoint ? "SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'START TRANSACTION');
}


Expand All @@ -198,7 +198,7 @@ public function begin(string $savepoint = null): void
*/
public function commit(string $savepoint = null): void
{
$this->query($savepoint ? "RELEASE SAVEPOINT $savepoint" : 'COMMIT');
$this->query($savepoint ? "RELEASE SAVEPOINT {$this->escapeIdentifier($savepoint)}" : 'COMMIT');
}


Expand All @@ -208,7 +208,7 @@ public function commit(string $savepoint = null): void
*/
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');
}


Expand Down

0 comments on commit 304af51

Please sign in to comment.