Added a bunch of index entries for the connection class.

This commit is contained in:
Daniele Varrazzo 2010-02-09 14:18:28 +00:00 committed by Federico Di Gregorio
parent a9b793a371
commit e0065bfbef

View File

@ -26,18 +26,27 @@ The ``connection`` class
cursors. The class returned should be a subclass of cursors. The class returned should be a subclass of
:class:`extensions.cursor`. See :ref:`subclassing-cursor` for details. :class:`extensions.cursor`. See :ref:`subclassing-cursor` for details.
.. index:
pair: Transaction, Commit
.. method:: commit() .. method:: commit()
Commit any pending transaction to the database. Psycopg can be set to Commit any pending transaction to the database. Psycopg can be set to
perform automatic commits at each operation, see perform automatic commits at each operation, see
:meth:`connection.set_isolation_level()`. :meth:`connection.set_isolation_level()`.
.. index:
pair: Transaction, Rollback
.. method:: rollback() .. method:: rollback()
Roll back to the start of any pending transaction. Closing a Roll back to the start of any pending transaction. Closing a
connection without committing the changes first will cause an implicit connection without committing the changes first will cause an implicit
rollback to be performed. rollback to be performed.
.. method:: close() .. method:: close()
Close the connection now (rather than whenever ``__del__`` is called). Close the connection now (rather than whenever ``__del__`` is called).
@ -49,6 +58,7 @@ The ``connection`` class
rollback to be performed (unless a different isolation level has been rollback to be performed (unless a different isolation level has been
selected: see :meth:`connection.set_isolation_level()`). selected: see :meth:`connection.set_isolation_level()`).
The above methods are the only ones defined by the |DBAPI 2.0|_ protocol. The above methods are the only ones defined by the |DBAPI 2.0|_ protocol.
The Psycopg connection objects exports the following additional methods The Psycopg connection objects exports the following additional methods
and attributes. and attributes.
@ -63,6 +73,11 @@ The ``connection`` class
Read-only string containing the connection string used by the Read-only string containing the connection string used by the
connection. connection.
.. index:
single: Autocommit
pair: Transaction; Isolation level
.. attribute:: isolation_level .. attribute:: isolation_level
.. method:: set_isolation_level(level) .. method:: set_isolation_level(level)
@ -81,6 +96,10 @@ The ``connection`` class
>>> conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) >>> conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
.. index::
pair: Client; Encoding
.. attribute:: encoding .. attribute:: encoding
.. method:: set_client_encoding(enc) .. method:: set_client_encoding(enc)
@ -92,7 +111,7 @@ The ``connection`` class
.. index:: .. index::
double: Client; Logging pair: Client; Logging
.. attribute:: notices .. attribute:: notices
@ -113,6 +132,10 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html .. __: http://www.postgresql.org/docs/8.4/static/runtime-config-logging.html
.. index::
pair: Backend; PID
.. method:: get_backend_pid() .. method:: get_backend_pid()
Returns the process ID (PID) of the backend server process handling Returns the process ID (PID) of the backend server process handling
@ -125,6 +148,10 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33590 .. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33590
.. index::
pair: Server; Parameters
.. method:: get_parameter_status(parameter) .. method:: get_parameter_status(parameter)
Look up a current parameter setting of the server. Look up a current parameter setting of the server.
@ -140,6 +167,10 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33499 .. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33499
.. index::
pair: Transaction; Status
.. method:: get_transaction_status() .. method:: get_transaction_status()
Return the current session transaction status as an integer. Symbolic Return the current session transaction status as an integer. Symbolic
@ -151,6 +182,10 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33480 .. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33480
.. index::
pair: Protocol; Version
.. attribute:: protocol_version .. attribute:: protocol_version
A read-only integer representing frontend/backend protocol being used. A read-only integer representing frontend/backend protocol being used.
@ -160,6 +195,10 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33546 .. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33546
.. index::
pair: Server; Version
.. attribute:: server_version .. attribute:: server_version
A read-only integer representing the backend version. A read-only integer representing the backend version.
@ -173,6 +212,9 @@ The ``connection`` class
.. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33556 .. __: http://www.postgresql.org/docs/8.4/static/libpq-status.html#AEN33556
.. index::
pair: Connection; Status
.. attribute:: status .. attribute:: status
A read-only integer representing the status of the connection. A read-only integer representing the status of the connection.
@ -205,6 +247,9 @@ The ``connection`` class
.. todo:: describe string_types .. todo:: describe string_types
.. index::
single: Exceptions; In the connection class
The :class:`connection` also exposes the same `Error` classes available in The :class:`connection` also exposes the same `Error` classes available in
the :mod:`psycopg2` module as attributes. the :mod:`psycopg2` module as attributes.