MCPcopy
hub / github.com/psycopg/psycopg / _check_connection_ok

Method _check_connection_ok

psycopg/psycopg/_connection_base.py:527–536  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

525 )
526
527 def _check_connection_ok(self) -> None:
528 if self.pgconn.status == OK:
529 return
530
531 if self.pgconn.status == BAD:
532 raise e.OperationalError("the connection is closed")
533 raise e.InterfaceError(
534 "cannot execute operations: the connection is"
535 f" in status {self.pgconn.status}"
536 )
537
538 def _start_query(self) -> PQGen[None]:
539 """Generator to start a transaction if necessary."""

Callers 6

_exec_commandMethod · 0.95
_deallocateMethod · 0.95
cursorMethod · 0.80
pipelineMethod · 0.80
cursorMethod · 0.80
pipelineMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected