diff --git a/psycopg/connection.h b/psycopg/connection.h index 33ad30b9..32aaddfc 100644 --- a/psycopg/connection.h +++ b/psycopg/connection.h @@ -48,9 +48,6 @@ extern "C" { #define CONN_STATUS_SEND_CLIENT_ENCODING 8 #define CONN_STATUS_SENT_CLIENT_ENCODING 9 #define CONN_STATUS_GET_CLIENT_ENCODING 10 -#define CONN_STATUS_SEND_TRANSACTION_ISOLATION 11 -#define CONN_STATUS_SENT_TRANSACTION_ISOLATION 12 -#define CONN_STATUS_GET_TRANSACTION_ISOLATION 13 /* async query execution status */ #define ASYNC_READ 1 diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 4646eea5..0fce84d6 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -404,11 +404,6 @@ conn_poll_send(connectionObject *self) query = psyco_client_encoding; next_status = CONN_STATUS_SENT_CLIENT_ENCODING; break; - case CONN_STATUS_SEND_TRANSACTION_ISOLATION: - /* get the default isolevel */ - query = psyco_transaction_isolation; - next_status = CONN_STATUS_SENT_TRANSACTION_ISOLATION; - break; default: /* unexpected state, error out */ PyErr_Format(OperationalError, @@ -444,9 +439,6 @@ conn_poll_send(connectionObject *self) case CONN_STATUS_SENT_CLIENT_ENCODING: next_status = CONN_STATUS_GET_CLIENT_ENCODING; break; - case CONN_STATUS_SENT_TRANSACTION_ISOLATION: - next_status = CONN_STATUS_GET_TRANSACTION_ISOLATION; - break; } } else { @@ -526,17 +518,17 @@ conn_poll_fetch(connectionObject *self) return NULL; } Dprintf("conn_poll_fetch: got client_encoding %s", self->encoding); - next_status = CONN_STATUS_SEND_TRANSACTION_ISOLATION; - } - else if (self->status == CONN_STATUS_GET_TRANSACTION_ISOLATION) { - /* got the default isolevel */ - self->isolation_level = conn_get_isolation_level(pgres); - Dprintf("conn_poll_fetch: got isolevel %ld", self->isolation_level); /* since this is the last step, set the other instance variables now */ self->equote = conn_get_standard_conforming_strings(self->pgconn); self->protocol = conn_get_protocol_version(self->pgconn); self->server_version = (int) PQserverVersion(self->pgconn); + /* + * asynchronous connections always use isolation level 0, the user is + * expected to manage the transactions himself, by sending + * (asynchronously) BEGIN and COMMIT statements. + */ + self->isolation_level = 0; Py_BEGIN_ALLOW_THREADS; pthread_mutex_lock(&(self->lock)); diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 3d5629d0..a4f54300 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -421,14 +421,12 @@ psyco_conn_poll(connectionObject *self) case CONN_STATUS_SEND_DATESTYLE: case CONN_STATUS_SEND_CLIENT_ENCODING: - case CONN_STATUS_SEND_TRANSACTION_ISOLATION: /* these mean that we need to wait for the socket to become writable to send the rest of our query */ return conn_poll_send(self); case CONN_STATUS_GET_DATESTYLE: case CONN_STATUS_GET_CLIENT_ENCODING: - case CONN_STATUS_GET_TRANSACTION_ISOLATION: /* these mean that we are waiting for the results of the queries */ return conn_poll_fetch(self);