1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

there is one problem with Zoltan patches commited into the tree:

if we set autocommit off and issued COMMIT (or ROLLBACK) on a connection
new transaction is not started

Max Khon
This commit is contained in:
Bruce Momjian
2000-12-15 19:11:28 +00:00
parent 326fbd8837
commit 0cf37659c4
2 changed files with 5 additions and 26 deletions

View File

@ -314,32 +314,18 @@ int i;
case SQL_AUTOCOMMIT:
/* Since we are almost always in a transaction, this is now ok.
Even if we were, the logic will handle it by sending a commit
after the statement.
if (CC_is_in_trans(conn)) {
conn->errormsg = "Cannot switch commit mode while a transaction is in progres";
conn->errormsg = "Cannot switch commit mode while a transaction is in progress";
conn->errornumber = CONN_TRANSACT_IN_PROGRES;
CC_log_error(func, "", conn);
return SQL_ERROR;
}
*/
mylog("SQLSetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam);
switch(vParam) {
case SQL_AUTOCOMMIT_OFF:
CC_set_autocommit_off(conn);
/* The following two lines are new.
With this modification the SELECT statements
are also included in the transactions.
Error handling should be written,
this is missing yet, see
SC_execute in statement.c for details. Zoltan
*/
CC_send_query(conn,"BEGIN",NULL);
CC_set_in_trans(conn);
break;
case SQL_AUTOCOMMIT_ON: