dbTalk Databases Forums  

[Info-Ingres] DEP, For loop and commit

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] DEP, For loop and commit in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] DEP, For loop and commit - 11-02-2011 , 05:48 AM






Hi All,

I have a database procedure which uses a for loop to control a large amountof processing. The body of the for loop has places where status messages are inserted in a table, plus many places where a database error could occuron other tasks.

The trouble is that if an error occurs then it causes a rollback in the directly exected procedure. This then erases all my status messages from the table.

So it occurred why not commit each status message insert....

But the for loop terminated on the first commit! Is it meant to do that? I didn't expect that, but reading between thelines on the commit documentation I suppose I'm not too surprised.

I tried putting the status message insert and commit into a separate procedure and calling that, but the same premature loop termination occurred.

Anyone have any thought on making the status message inserts bullet proof?

I'm thinking of attempting to rewrite the procedure to use a while loop, but I suspect the commit will have the same effect.

The only other thought I've had is to get it to raise an event. But then I need an event handler to capture these events and do the job. Which seems way to complicated!

FYI. I've made it log the status messages into a table as I couldn't work out how to get Perl DBI to get messages generated by the message command inside the DEP.

Martin Bowes

Reply With Quote
  #2  
Old   
Roy Hann
 
Posts: n/a

Default Re: [Info-Ingres] DEP, For loop and commit - 11-02-2011 , 06:24 AM






Martin Bowes wrote:

Quote:
Hi All,

I have a database procedure which uses a for loop to control a large amount of
processing. The body of the for loop has places where status messages
are inserted in a table, plus many places where a database error could
occur on other tasks.

The trouble is that if an error occurs then it causes a rollback in the
directly exected procedure. This then erases all my status messages
from the table.

So it occurred why not commit each status message insert....

But the for loop terminated on the first commit! Is it meant to do that?
I didn't expect that, but reading between thelines on the commit
documentation I suppose I'm not too surprised.

I tried putting the status message insert and commit into a separate
procedure and calling that, but the same premature loop termination
occurred.

Anyone have any thought on making the status message inserts bullet proof?

I'm thinking of attempting to rewrite the procedure to use a while loop,
but I suspect the commit will have the same effect.

The only other thought I've had is to get it to raise an event. But then
I need an event handler to capture these events and do the job. Which
seems way to complicated!

FYI. I've made it log the status messages into a table as I couldn't work
out how to get Perl DBI to get messages generated by the message
command inside the DEP.
The MESSAGE statement allows you to direct the message to errlog.log or
the audit log using WITH DESTINATION=ERROR_LOG or AUDIT_LOG. Writing to
the log files is not transactional.

--
Roy

UK Ingres User Association Conference 2012 will be on Tuesday June 19 2012.
The latest information is available from www.uk-iua.org.uk.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.