Search This Blog

Monday, April 1, 2013

App Engine: Do-Select with Re-Select option

Few pointers on using Do-Select with Re-Select option

For each iteration of the loop, Application Engine opens a cursor and fetches the
first row.

Your program processes the first row returned from the Select statement.
The cursor is reopened for each iteration of the loop.

With this type of Fetch statement, you typically want some aspect of the loop to
eventually cause the Select statement to return no rows.

Otherwise, there is no mechanism in place by which to exit the loop. This type of

Do Select is restartable.

For new Application Engine programs that you develop, by default, the commit
values at the section and the step level are turned off.

No commits occur during the program run, except for the implicit commit that occurs after the successful completion of the program.

For row-based processing, commit after every N iterations of the main fetch loop
that drives the process.

One technique for accomplishing this is to have a processed flag that you check
in the Where clause of the Do Select action,and you perform an update inside the loop (and before the commit) to set the flag to Y on each row that you fetch.

No comments: