mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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:
@ -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);
|
||||
|
Reference in New Issue
Block a user