summaryrefslogtreecommitdiff
path: root/lib/extensions.py
diff options
context:
space:
mode:
authorJames Henstridge <james@jamesh.id.au>2008-01-16 05:14:24 +0000
committerJames Henstridge <james@jamesh.id.au>2008-01-16 05:14:24 +0000
commitf64cbeda4606d8af3ca063736f313f81506c56bb (patch)
tree0f0de0dddb735963bb348e2e6eae4371ecfe47b2 /lib/extensions.py
parent46bf23caf47c3f08194e524312b5afbe0c449b70 (diff)
downloadpsycopg2-f64cbeda4606d8af3ca063736f313f81506c56bb.tar.gz
* tests/test_transaction.py (DeadlockSerializationTestCase): port
over some tests for serialisation and deadlock errors, demonstrating that TransactionRollbackError is generated. (QueryCancelationTests): add a test to show that QueryCanceledError is raised on statement timeouts. * psycopg2da/adapter.py (_handle_psycopg_exception): rather than checking exception messages, check for TransactionRollbackError. * psycopg/pqpath.c (exception_from_sqlstate): return TransactionRollbackError for 40xxx errors, and QueryCanceledError for 57014 errors. (pq_raise): If we are using an old server, use TransactionRollbackError if the error message contains "could not serialize" or "deadlock detected". * psycopg/psycopgmodule.c (_psyco_connect_fill_exc): remove function, since we no longer need to store pointers to the exceptions in the connection. This also fixes a reference leak. (psyco_connect): remove _psyco_connect_fill_exc() function call. * psycopg/connection.h (connectionObject): remove exception members from struct. * psycopg/connection_type.c (connectionObject_getsets): modify the exception attributes on the connection object from members to getsets. This reduces the size of the struct. * lib/extensions.py: import the two new extensions. * psycopg/psycopgmodule.c (exctable): add new QueryCanceledError and TransactionRollbackError exceptions.
Diffstat (limited to 'lib/extensions.py')
-rw-r--r--lib/extensions.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/extensions.py b/lib/extensions.py
index fe61303..a2bc869 100644
--- a/lib/extensions.py
+++ b/lib/extensions.py
@@ -42,6 +42,8 @@ from _psycopg import adapt, adapters, encodings, connection, cursor
from _psycopg import string_types, binary_types, new_type, register_type
from _psycopg import ISQLQuote
+from _psycopg import QueryCanceledError, TransactionRollbackError
+
"""Isolation level values."""
ISOLATION_LEVEL_AUTOCOMMIT = 0
ISOLATION_LEVEL_READ_COMMITTED = 1