@@ -750,12 +750,12 @@ QueryInfo qi;
750750 starting a transaction first.
751751
752752 A transaction should be begun if and only if
753- we use declare/fetch and the statement is SELECT.
753+ we use declare/fetch and the statement is SELECT
754+ or we are not in autocommit state
754755 We assume that the Postgres backend has an autocommit
755756 feature as default. (Zoltan Kovacs, 04/26/2000)
756757 */
757- // if ( ! self->internal && ! CC_is_in_trans(conn) && (globals.use_declarefetch || STMT_UPDATE(self))) {
758- if ( ! self -> internal && ! CC_is_in_trans (conn ) && globals .use_declarefetch && self -> statement_type == STMT_TYPE_SELECT ) {
758+ if ( ! self -> internal && ! CC_is_in_trans (conn ) && ((globals .use_declarefetch && self -> statement_type == STMT_TYPE_SELECT ) || ! CC_is_in_autocommit (conn ))) {
759759
760760 mylog (" about to begin a transaction on statement = %u\n" , self );
761761 res = CC_send_query (conn , "BEGIN" , NULL );
@@ -831,16 +831,9 @@ QueryInfo qi;
831831 mylog (" it's NOT a select statement: stmt=%u\n" , self );
832832 self -> result = CC_send_query (conn , self -> stmt_with_params , NULL );
833833
834- /* If we are in autocommit, we must send the commit. */
835- /* No, we shouldn't. Postgres backend does the
834+ /* We shouldn't send COMMIT. Postgres backend does the
836835 autocommit if neccessary. (Zoltan, 04/26/2000)
837836 */
838- /* if ( ! self->internal && CC_is_in_autocommit(conn) && STMT_UPDATE(self)) {
839- res = CC_send_query(conn, "COMMIT", NULL);
840- QR_Destructor(res);
841- CC_set_no_trans(conn);
842- }*/
843-
844837 }
845838
846839 conn -> status = oldstatus ;
0 commit comments