MCPcopy
hub / github.com/psycopg/psycopg / _commit_gen

Method _commit_gen

psycopg/psycopg/_connection_base.py:570–588  ·  view source on GitHub ↗

Generator implementing `Connection.commit()`.

(self)

Source from the content-addressed store, hash-verified

568 return self._begin_statement
569
570 def _commit_gen(self) -> PQGen[None]:
571 """Generator implementing `Connection.commit()`."""
572 if self._num_transactions:
573 raise e.ProgrammingError(
574 "Explicit commit() forbidden within a Transaction "
575 "context. (Transaction will be automatically committed "
576 "on successful exit from context.)"
577 )
578 if self._tpc:
579 raise e.ProgrammingError(
580 "commit() cannot be used during a two-phase transaction"
581 )
582 if self.pgconn.transaction_status == IDLE:
583 return
584
585 yield from self._exec_command(b"COMMIT")
586
587 if self._pipeline:
588 yield from self._pipeline._sync_gen()
589
590 def _rollback_gen(self) -> PQGen[None]:
591 """Generator implementing `Connection.rollback()`."""

Callers

nothing calls this directly

Calls 2

_exec_commandMethod · 0.95
_sync_genMethod · 0.80

Tested by

no test coverage detected