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/misc.c | |
parent | 1a996d6c2972b343d8ec446d1c7c4c5fa8e19ef4 (diff) |
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/misc.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/misc.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 20725e44e52..98e0597b03c 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -206,7 +206,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction) * developers have to take care themselves. However, if the command is * a begin statement, we just execute it once. */ - if (con->committed && !con->autocommit && strncmp(transaction, "begin", 5) != 0 && strncmp(transaction, "start", 5) != 0) + if (PQtransactionStatus(con->connection) == PQTRANS_IDLE && !con->autocommit && strncmp(transaction, "begin", 5) != 0 && strncmp(transaction, "start", 5) != 0) { res = PQexec(con->connection, "begin transaction"); if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL)) @@ -218,11 +218,6 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction) if (!ecpg_check_PQresult(res, lineno, con->connection, ECPG_COMPAT_PGSQL)) return FALSE; PQclear(res); - - if (strncmp(transaction, "commit", 6) == 0 || strncmp(transaction, "rollback", 8) == 0) - con->committed = true; - else - con->committed = false; } return true; |