Just for completeness sake : I've just discovered that the side-effect seems
to be due to "Server conn Commit", rather than to "Server conn Begin
Transaction".

And even thought the manual for "Server Commit" says "Then you must issue a
new Server Begin Transaction statement following the Server Commit command
to begin a new transaction", I still find it's a longshot to imply that this
mean that the transaction is made READ ONLY after a commit, when it's not
read only when the connection is first opened.

Best regards / Med venlig hilsen
Lars V. Nielsen
--------------------------------------------------------
Hvenegaard & Meklenborg
Rugaardsvej 55, DK-5000 Odense C
Denmark
http://www.hvm.dk
----- Original Message ----- 
From: "Lars V. Nielsen (HVM)" <[EMAIL PROTECTED]>
To: "MapInfo-L" <[EMAIL PROTECTED]>
Sent: Monday, July 05, 2004 11:56 AM
Subject: MI-L Server conn Begin Transaction - undocumented side effect ?


Hi,

I've just now began using the statement "Server conn Begin Transaction", and
have uncovered a snag (bug?) in my preliminary testing. I'm using MB 6.5
with Oracle 9i, but it's most likely generic.

According to the MB manual, "Begin Transaction" caches all commands until
either a "Server conn Commit" or "Server conn Rollback" is issued. So far so
good.

But it seems that using "Begin Transaction" puts the transaction environment
into some sort of READ ONLY state unless you keep using this statement over
and over.

This statement sequence works and inserts the values 1 - 4

Hconn = Server_Connect (...)
Server Hconn Begin Transction
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (1)")
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (2)")
Server Hconn Commit
Server Hconn Begin Transction
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (3)")
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (4)")
Server Hconn Commit

If I remove the second "Begin Transaction", i.e.:

Hconn = Server_Connect (...)
Server Hconn Begin Transction
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (1)")
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (2)")
Server Hconn Commit
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (3)")
Hstmt = Server_Execute (Hconn, "Insert Into TEST Values (4)")
Server Hconn Commit

The statement inserting the value 3 throws an error saying "INSERT, DELETE
or UPDATE statements cannot be executed in a READ ONLY transaction"
(transluted from Danish so the wording may be a bit off).

Clearly issuing a "Begin Transaction" triggers an undocumented side effect
(probably using Oracle's "SET TRANSACTION" command). And COMMIT clearly
doesn't clear this state, forcing one to keep using "Begin Transaction", a
somewhat problematic behaviour imho. The logical assumption would have it
return to the default (auto-commit?) behaviour after a rollback/commit
statement.

Can anyone confirm this problematic behaviour ?

Has anyone else used this statement ? If so, has anyone experienced this
kind of behaviour before ?

Best regards / Med venlig hilsen
Lars V. Nielsen
--------------------------------------------------------
Hvenegaard & Meklenborg
Rugaardsvej 55, DK-5000 Odense C
Denmark
http://www.hvm.dk


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12454

Reply via email to