patch: implicit rollback
am 12.01.2006 15:14:20 von Ludek Finstrle--V0207lvV8h4k8FAm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hello,
there is still bug in implicit rollback. I try solve it better.
Patch is attached.
Please review and comment
Luf
--V0207lvV8h4k8FAm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="psqlodbc-implicit_rollback.diff"
diff -c psqlodbc.orig\connection.c psqlodbc\connection.c
*** psqlodbc.orig\connection.c Sun Jan 08 12:12:01 2006
--- psqlodbc\connection.c Thu Jan 12 14:53:34 2006
***************
*** 1506,1527 ****
{
if ((res->status == PGRES_EMPTY_QUERY) || (res->status == PGRES_BAD_RESPONSE))
{
! if (CC_is_in_autocommit(self) && !CC_is_in_manual_trans(self))
! {
! mylog("send_query: sending query failed -> abort\n");
! QR_set_aborted(res, TRUE);
! }
QR_Destructor(res);
res = NULL;
goto cleanup;
}
else if (res->status == PGRES_FATAL_ERROR)
{
! if (CC_is_in_autocommit(self) && !CC_is_in_manual_trans(self))
! {
! mylog("send_query: sended query failed -> abort\n");
! QR_set_aborted(res, TRUE);
! }
goto cleanup;
}
if (create_keyset)
--- 1474,1489 ----
{
if ((res->status == PGRES_EMPTY_QUERY) || (res->status == PGRES_BAD_RESPONSE))
{
! mylog("send_query: sending query failed -> abort\n");
! QR_set_aborted(res, TRUE);
QR_Destructor(res);
res = NULL;
goto cleanup;
}
else if (res->status == PGRES_FATAL_ERROR)
{
! mylog("send_query: sended query failed -> abort\n");
! QR_set_aborted(res, TRUE);
goto cleanup;
}
if (create_keyset)
diff -c psqlodbc.orig\statement.c psqlodbc\statement.c
*** psqlodbc.orig\statement.c Sat Dec 10 08:39:31 2005
--- psqlodbc\statement.c Thu Jan 12 15:32:57 2006
***************
*** 590,596 ****
* transaction.
*/
conn = SC_get_conn(self);
! if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
{
if (SC_is_pre_executable(self) && !conn->connInfo.disallow_premature)
CC_abort(conn);
--- 590,597 ----
* transaction.
*/
conn = SC_get_conn(self);
! if (CC_is_in_trans(conn) && !CC_is_in_autocommit(conn) &&
! !CC_is_in_manual_trans(conn))
{
if (SC_is_pre_executable(self) && !conn->connInfo.disallow_premature)
CC_abort(conn);
***************
*** 1180,1190 ****
auto_begin = TRUE;
if (PG_VERSION_GE(conn, 7.1))
qflag |= GO_INTO_TRANSACTION;
! else if (!CC_begin(conn))
! {
SC_set_error(self, STMT_EXEC_ERROR, "Could not begin a transaction");
goto cleanup;
! }
}
oldstatus = conn->status;
--- 1181,1191 ----
auto_begin = TRUE;
if (PG_VERSION_GE(conn, 7.1))
qflag |= GO_INTO_TRANSACTION;
! else if (!CC_begin(conn))
! {
SC_set_error(self, STMT_EXEC_ERROR, "Could not begin a transaction");
goto cleanup;
! }
}
oldstatus = conn->status;
***************
*** 1251,1257 ****
*/
if (CC_is_in_trans(conn))
{
! if (!is_in_trans)
CC_set_in_manual_trans(conn);
if (!self->internal && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn))
CC_commit(conn);
--- 1252,1258 ----
*/
if (CC_is_in_trans(conn))
{
! if (!is_in_trans && !auto_begin)
CC_set_in_manual_trans(conn);
if (!self->internal && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn))
CC_commit(conn);
***************
*** 1288,1294 ****
/* issue "ABORT" when query aborted */
if (QR_get_aborted(res))
{
! if (!self->internal)
CC_abort(conn);
}
else
--- 1289,1295 ----
/* issue "ABORT" when query aborted */
if (QR_get_aborted(res))
{
! if (!self->internal && CC_is_in_trans(conn) && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn))
CC_abort(conn);
}
else
***************
*** 1335,1341 ****
SC_set_error(self, STMT_EXEC_ERROR, CC_get_errormsg(conn));
}
! if (!self->internal)
CC_abort(conn);
}
if (!SC_get_Result(self))
--- 1336,1342 ----
SC_set_error(self, STMT_EXEC_ERROR, CC_get_errormsg(conn));
}
! if (!self->internal && CC_is_in_trans(conn) && CC_is_in_autocommit(conn) && !CC_is_in_manual_trans(conn))
CC_abort(conn);
}
if (!SC_get_Result(self))
--V0207lvV8h4k8FAm
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
--V0207lvV8h4k8FAm--