@@ -750,12 +750,12 @@ QueryInfo qi;
750
750
starting a transaction first.
751
751
752
752
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
754
755
We assume that the Postgres backend has an autocommit
755
756
feature as default. (Zoltan Kovacs, 04/26/2000)
756
757
*/
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 ))) {
759
759
760
760
mylog (" about to begin a transaction on statement = %u\n" , self );
761
761
res = CC_send_query (conn , "BEGIN" , NULL );
@@ -831,16 +831,9 @@ QueryInfo qi;
831
831
mylog (" it's NOT a select statement: stmt=%u\n" , self );
832
832
self -> result = CC_send_query (conn , self -> stmt_with_params , NULL );
833
833
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
836
835
autocommit if neccessary. (Zoltan, 04/26/2000)
837
836
*/
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
-
844
837
}
845
838
846
839
conn -> status = oldstatus ;
0 commit comments