Transaction Isolation Level

From: "Jason Koeninger" <jkoenin(at)jjcc(dot)com>
To: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Transaction Isolation Level
Date: 2002-08-11 00:08:13
Message-ID: 20020811001349.032A2475178@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

The reporting system in my current project has the need for serialized
transactions so numbers can be consistent coming from two queries
within one transaction. Using a psql command line, I can test the
functionality I need using:

begin;
set transaction isolation level serializable;
select count(*) from mytable;
*** Perform insert on mytable from another connection here
select count(*) from mytable;
end;

Both selects should give me the same result (which they do). The problem
I'm having is when I try to translate this into ODBC. It appears from the
driver code that the ODBC driver automatically calls BEGIN when not in
autocommit mode and only does it for a certain set of functions (insert,
update, delete, grant, revoke, and a couple others I'm forgetting).
Consequently, the "set transaction" statement executed from an ODBC
application is useless because it's not done inside the current transaction.
The normal solution would be to use SQLSetConnectOption with
SQL_TXN_ISOLATION set to SQL_TXN_SERIALIZABLE, but the
ODBC driver ignores those settings (according to the source).

So, I'm wondering how to get a serialized transaction through ODBC
without making changes to the driver source.

Thanks,

Jason Koeninger
J&J Computer Consulting

Browse pgsql-odbc by date

  From Date Subject
Next Message Oleg Grodzevich 2002-08-15 06:43:39 BEGIN in windows ODBC driver
Previous Message Markus Wollny 2002-08-10 18:42:44 Re: Severe problems with ColdFusion 5, ODBC and PostgreSQL 7.2.1