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