Re: Multiple Nested Cursors in ESQL/C
Posted in 1994
In article <CsHo6v.8FC@metronet.com> gwr@metronet.com (George Rapp) writes: [example of nested cursors] > etc., up to six levels of nested cursors. > > Is this a legal thing to do? I couldn't find any information advising > me NOT to do it in the Informix documentation, but it doesn't work. > Working with dynamic SQL (via a proprietary interface), I am using C macros FOR_ALL_ROWS(...) { /* what to do with the rows */ } END_FOR_ALL_ROWS(ErrorCode); It sometimes happens that, that functions are recursively called (using dynamic cursor naming, this causes no problems at all :). Sometimes, somewhere, on some level of nesting, a pair of macros BEGIN_TRANSACTION_BLOCK { /* do something inside a transaction */ } END_TRANSACTION_BLOCK; implements (even nested) transactions using nesting count. If a TRANSACTION_BLOCK occurs inside the lifetime of a cursor, the cursor disappears after a ROLLBACK or COMMIT WORK, if it is not declared WITH HOLD. This causes the FOR_ALL_ROWS loop to be executed only one time. Thus, if you have any transactions closing in a nested cursor loop, it may close all cursores not declared HOLD. There may be a small possibility that this helps. Heinrich. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= "It's, of course, of no disadvantage for the Union having an attractive candidate." Helmut Kohl, German Chancellor an again candidate for elections in Oct.'94 /M/A/I Deutschland GmbH, Softwarezentrum Koeln Heinrich Seebauer Mathias-Brueggen-Str. 85 Software Engineering 50829 Koeln, Federal Republic of Germany Phone: x221/956400-0 Phax: x221/956400-69 emale: heinrich@mai.de =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=