diff options
author | Michael Meskes <meskes@postgresql.org> | 2010-10-14 17:55:07 +0200 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2010-10-14 17:55:07 +0200 |
commit | 816b008eaf1a1ff1069f3bafff363a9a8bf04a21 (patch) | |
tree | 2785ed9cfac2e7f1ec34222fe688aff9ab776d4d /src/interfaces/ecpg/ecpglib/connect.c | |
parent | 1a996d6c2972b343d8ec446d1c7c4c5fa8e19ef4 (diff) | |
download | postgresql-816b008eaf1a1ff1069f3bafff363a9a8bf04a21.tar.gz postgresql-816b008eaf1a1ff1069f3bafff363a9a8bf04a21.zip |
Applied patch by Itagaki Takahiro to fix incorrect status calculation in
ecpglib. Instead of parsing the statement just as ask the database server. This
patch removes the whole client side track keeping of the current transaction
status.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/connect.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 56a732a4980..0091b5dc98f 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -167,25 +167,23 @@ ECPGsetcommit(int lineno, const char *mode, const char *connection_name) if (con->autocommit == true && strncmp(mode, "off", strlen("off")) == 0) { - if (con->committed) + if (PQtransactionStatus(con->connection) == PQTRANS_IDLE) { results = PQexec(con->connection, "begin transaction"); if (!ecpg_check_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL)) return false; PQclear(results); - con->committed = false; } con->autocommit = false; } else if (con->autocommit == false && strncmp(mode, "on", strlen("on")) == 0) { - if (!con->committed) + if (PQtransactionStatus(con->connection) != PQTRANS_IDLE) { results = PQexec(con->connection, "commit"); if (!ecpg_check_PQresult(results, lineno, con->connection, ECPG_COMPAT_PGSQL)) return false; PQclear(results); - con->committed = true; } con->autocommit = true; } @@ -540,7 +538,6 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p pthread_mutex_unlock(&connections_mutex); #endif - this->committed = true; this->autocommit = autocommit; PQsetNoticeReceiver(this->connection, &ECPGnoticeReceiver, (void *) this); |