24 use Psr\Log\LoggerInterface;
50 $this->didbegin =
false;
53 $dbw->
begin( __CLASS__, DatabasePostgres::TRANSACTION_INTERNAL );
54 $this->didbegin =
true;
59 if ( $this->didbegin ) {
60 $this->dbw->rollback();
61 $this->didbegin =
false;
66 if ( $this->didbegin ) {
67 $this->dbw->commit( __CLASS__, DatabasePostgres::FLUSHING_INTERNAL );
68 $this->didbegin =
false;
72 protected function query( $keyword, $msg_ok, $msg_failed ) {
73 if ( $this->dbw->doQuery( $keyword .
" " . $this->id ) !==
false ) {
74 $this->logger->debug( sprintf( $msg_ok, $this->
id ) );
76 $this->logger->debug( sprintf( $msg_failed, $this->
id ) );
81 $this->
query(
"SAVEPOINT",
82 "Transaction state: savepoint \"%s\" established.\n",
83 "Transaction state: establishment of savepoint \"%s\" FAILED.\n"
88 $this->
query(
"RELEASE",
89 "Transaction state: savepoint \"%s\" released.\n",
90 "Transaction state: release of savepoint \"%s\" FAILED.\n"
95 $this->
query(
"ROLLBACK TO",
96 "Transaction state: savepoint \"%s\" rolled back.\n",
97 "Transaction state: rollback of savepoint \"%s\" FAILED.\n"