1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

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.
This commit is contained in:
Michael Meskes
2010-10-14 17:55:07 +02:00
parent 1a996d6c29
commit 816b008eaf
4 changed files with 4 additions and 14 deletions

View File

@ -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;