Luca,

I would prefer to use stored procedures, but they are not implemented yet in MySQL and we use MySQL in all our applications. MySQL doesn't suport the begin-end; construction you used below either AFAIK.

/Daniel Fagerstrom

Luca Morandini wrote:
Sylvian,

I'm not completely convinced a rewriting of SQLTransformer is needed to handle transactions... I tried the following:

<sql:query isstoredprocedure="false">
	name="test">
	begin
		DELETE FROM CRRegion
			WHERE Id > 80;
		COMMIT;
		INSERT INTO CRRegion
			(Id, Name)
			VALUES
			('90', 'Foo');
		INSERT INTO CRRegion
			(Id, Name)
			VALUES
			('91', 'Bar');
		ROLLBACK;
	end;
</sql:query>

And it worked just fine (both the commit and the rollback parts). I even tried
some variations on this theme and they worked just as well.

There is a catch though: I tried on Oracle only.
I don't know whether the begin/end statement could be used with other DBMSes.

Anyway, I agree the use of a single connection to process the complete input document would increase performance and reduce
side-effects.

Best regards,

P.S.
As you may easily imagine, I consider Stored Procedures the only proper place for handling transactions; but, if people cannot/want
not go for SPs... let's give them some alternatives.

---------------------------------------------
               Luca Morandini
               GIS Consultant
              [EMAIL PROTECTED]
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to