cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kavanagh <...@dotech.com>
Subject SQLTransformer + Transactions (via JDBC)
Date Sun, 18 May 2003 22:53:00 GMT
I asked about transaction support in the SQLTransformer and got some 
good suggestions about using some DB specific SQL. I might have gone 
that way (we use Oracle 9i), but I wanted something more portable.

Daniel Fagerstrom posted about a patch he wrote that allowed the 
SQLTransformer to share a connection among top level queries. Great, 
half way there! (Here's the link for that patch... 
http://issues.apache.org/bugzilla/show_bug.cgi?id=16718).

I added in code to support setting a parameter like this;

                <map:transform type="sql">
                    <map:parameter name="use-connection" value="mbrdb"/>
                    <map:parameter name="enable-transaction" value="true"/>
                </map:transform>

I put the code in the SQLTransformer to turn off the auto-commit flag 
and to issue the appropriate commit/rollback calls (on error). It works 
for a couple inserts I threw together. If I put an error in the second 
insert, the first is rolled back. If both are good, they both are 
commited. :-)
I'm attaching the revised SQLTransformer. I know you guys like to see 
patches, so I attached that also. For now, this code has Daniel's patch 
applied (onto the 2.0.4 version) and my additions are bounded by 
comments (i.e. // DAK: Transaction and // DAK)
Is this something that can be put into the scratchpad? We could give it 
a different package so people could just choose it in the sitemap.xmap

David

Mime
View raw message