Hello,

I am interfacing an XML file with a database, much like the last example at 
http://www.xmltwig.com/xmltwig/tutorial/yapc_twig_s5.html 
What I am actually doing is checking if the table already got such a record,
if so - updating it, otherwise inserting it, but this is not relevant.

Either way I can't figure out how to raise an exception in the insert_row
subroutine so that the parsefile() will die as well. Since I am working with
records totalling several gigabytes, I am checking every SQL operation by
evaling them with RaiseError turned on. This doesn't help me much, however,
since the best I can do after a failure is return from the subroutine and
XML::Twig will continue with its business. I could issue a finish() and the
parser should (?) stop processing the XML, but it will still return with a
success (I am performing safe_parsefile), and it actually doesn't seem to
stop at all, chewing through the rest of the file. If this is true (finish()
works as I think it works) then I guess I could use a global flag that will
be raised if one of the inserts fails. Then after the parsefile() I will
check it and rollback all changes to the db, but this seems really retarded.
Are there some better ways to do this that I am overlooking?

Thanks

Peter

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to