Re: some question about SavePoint ?

From: Ludek Finstrle <luf(at)pzkagis(dot)cz>
To: zhaoxin <zhaox(at)necas(dot)nec(dot)com(dot)cn>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: some question about SavePoint ?
Date: 2006-01-19 11:19:57
Message-ID: 20060119111957.GA31571@soptik.pzkagis.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

> After I execute a SQL , I want to ignore some error ,and continue to
> execute my SQL.but I will get some error like that :
>
> "current transaction is aborted, commands ignored until end of
> transaction block"

There is some common known bugs in 08.01.0102 in implicit rollback.
Do you try latest development snapshot?
Maybe 08.01.0106 could better fit you. I don't know. We have some report
about similar problem (but reporter doesn't mentioned his psqlodbc version).

> I try to use SavePoint to solve this trouble , but I got some problem .
> example:
> .....
> 1. set SQL_AUTOCOMMIT_OFF

In this case you may call BEGIN (START TRANSACTION is supported since
08.01.0107).

> 2. SQLConnect()
> ..............
> 3. SQLExecDirect() -> SavePoint sp ;
> 4. SQLExecDirect() -> insert into test values(...) ;
> 5. SQLExecDirect() -> Release SavePoint sp;
> 6. SQLEndTran() -> commit ;
> 7. SQLExecDirect() -> SavePoint sp ;
> ^^^^^^^^^^^^^^^^
> 8. SQLExecDirect() -> update test;
> .............
>
> Until 6, it return OK, but at 7 , it will return some error like
>
> "SAVEPOINT may only be used in transaction blocks"
>
> so , I have to use "begin" to start another transaction after I execute
> the "commit" at 6 ?
> Why can I use savepoint at 3 without execute any "begin" ???
> Or I have some mistake ?

Yes you do ... When you use autocommit = off you have to start and end
transaction manually. There is hack in psqlodbc which start transaction
automatically even in autocommit = off when you use select, insert, update
or delete SQL statement.

> My psqlodbc version is 8.01.01.02(Unicode)
>
> And, I have to use SavePoint to rollback to current SQL?
> Don't I have another way in psqlodbc ?

What about try the latest development snapshot as I mentioned above?

Regards,

Luf

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Ludek Finstrle 2006-01-19 11:23:31 Re: Odbcapi30.c - 64 bit compiler warning cleanup
Previous Message Dave Page 2006-01-19 11:11:02 Odbcapi30.c - 64 bit compiler warning cleanup