Author: cito
Date: Fri Jan 15 10:23:38 2016
New Revision: 751
Log:
Mention the SQLSTATE error code in the pgdb docs
Modified:
branches/4.x/docs/contents/pg/connection.rst
branches/4.x/docs/contents/pgdb/cursor.rst
branches/4.x/docs/contents/pgdb/module.rst
trunk/docs/contents/pg/connection.rst
trunk/docs/contents/pgdb/cursor.rst
trunk/docs/contents/pgdb/module.rst
Modified: branches/4.x/docs/contents/pg/connection.rst
==============================================================================
--- branches/4.x/docs/contents/pg/connection.rst Fri Jan 15 10:02:58
2016 (r750)
+++ branches/4.x/docs/contents/pg/connection.rst Fri Jan 15 10:23:38
2016 (r751)
@@ -61,8 +61,8 @@
unknown data without worrying about SQL injection or syntax errors.
When the database could not process the query, a :exc:`pg.ProgrammingError` or
-a :exc:`pg.InternalError` is raised. You can check the ``SQLSTATE`` code of
-this error by reading its :attr:`sqlstate` attribute.
+a :exc:`pg.InternalError` is raised. You can check the ``SQLSTATE`` error code
+of this error by reading its :attr:`sqlstate` attribute.
Example::
Modified: branches/4.x/docs/contents/pgdb/cursor.rst
==============================================================================
--- branches/4.x/docs/contents/pgdb/cursor.rst Fri Jan 15 10:02:58 2016
(r750)
+++ branches/4.x/docs/contents/pgdb/cursor.rst Fri Jan 15 10:23:38 2016
(r751)
@@ -91,6 +91,13 @@
rows in a single operation, but this kind of usage is deprecated:
:meth:`pgdbCursor.executemany` should be used instead.
+Note that in case this method raises a :exception:`DatabaseError`, you can
+get information about the error condition that has occurred by introspecting
+its :attr:`DatabaseError.sqlstate` attribute, which will be the ``SQLSTATE``
+error code associated with the error. Applications that need to know which
+error condition has occurred should usually test the error code, rather than
+looking at the textual error message.
+
executemany -- execute many similar database operations
-------------------------------------------------------
Modified: branches/4.x/docs/contents/pgdb/module.rst
==============================================================================
--- branches/4.x/docs/contents/pgdb/module.rst Fri Jan 15 10:02:58 2016
(r750)
+++ branches/4.x/docs/contents/pgdb/module.rst Fri Jan 15 10:23:38 2016
(r751)
@@ -82,6 +82,9 @@
Exception raised for errors that are related to the database.
+ In PyGreSQL, this also has a :attr:`DatabaseError.sqlstate` attribute
+ that contains the ``SQLSTATE`` error code of this error.
+
.. exception:: DataError
Exception raised for errors that are due to problems with the processed
Modified: trunk/docs/contents/pg/connection.rst
==============================================================================
--- trunk/docs/contents/pg/connection.rst Fri Jan 15 10:02:58 2016
(r750)
+++ trunk/docs/contents/pg/connection.rst Fri Jan 15 10:23:38 2016
(r751)
@@ -61,8 +61,8 @@
unknown data without worrying about SQL injection or syntax errors.
When the database could not process the query, a :exc:`pg.ProgrammingError` or
-a :exc:`pg.InternalError` is raised. You can check the ``SQLSTATE`` code of
-this error by reading its :attr:`sqlstate` attribute.
+a :exc:`pg.InternalError` is raised. You can check the ``SQLSTATE`` error code
+of this error by reading its :attr:`sqlstate` attribute.
Example::
Modified: trunk/docs/contents/pgdb/cursor.rst
==============================================================================
--- trunk/docs/contents/pgdb/cursor.rst Fri Jan 15 10:02:58 2016 (r750)
+++ trunk/docs/contents/pgdb/cursor.rst Fri Jan 15 10:23:38 2016 (r751)
@@ -96,6 +96,13 @@
rows in a single operation, but this kind of usage is deprecated:
:meth:`Cursor.executemany` should be used instead.
+Note that in case this method raises a :exception:`DatabaseError`, you can
+get information about the error condition that has occurred by introspecting
+its :attr:`DatabaseError.sqlstate` attribute, which will be the ``SQLSTATE``
+error code associated with the error. Applications that need to know which
+error condition has occurred should usually test the error code, rather than
+looking at the textual error message.
+
executemany -- execute many similar database operations
-------------------------------------------------------
Modified: trunk/docs/contents/pgdb/module.rst
==============================================================================
--- trunk/docs/contents/pgdb/module.rst Fri Jan 15 10:02:58 2016 (r750)
+++ trunk/docs/contents/pgdb/module.rst Fri Jan 15 10:23:38 2016 (r751)
@@ -81,6 +81,9 @@
Exception raised for errors that are related to the database.
+ In PyGreSQL, this also has a :attr:`DatabaseError.sqlstate` attribute
+ that contains the ``SQLSTATE`` error code of this error.
+
.. exception:: DataError
Exception raised for errors that are due to problems with the processed
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql