Re: 4GL Cursors again
Posted in 1997
Hi, Sorry for jumping in like these, but I can tell You know more about cursors then me. I am trying to keep compatibility with pre-V 5.0 OnLine server in 4GL app, by keeping the limit on prepare & declare stmts., but reducing number of declare stmts. alone did not helped. If I'm not missing something, it should (?) Finderr: -257 System limit on maximum number of statements exceeded, maximum is count. The database server can handle only a fixed number of prepared SQL statements for each user. Included in this limit are statements prepared with the PREPARE statement and cursors declared with DECLARE. This statement (a PREPARE, DECLARE, or PREPARE IMMEDIATE) exceeds that limit. The statement is not executed. The FREE statement releases prepared statements. Review the logic of your program and change it so that it frees prepared statements when they are no longer needed. Note: This restriction is removed starting with database servers at software level 5.0; however, programs that might have to be compatible with earlier versions should still use FREE to stay under the limit. This message is not used by database servers later than Version 5.01. but, I writhed a test program with 70 times (my limit is 64) of: declare a1 scroll cursor for x1 open a1 fetch first a1 into p_test.* ....... declare a70 scroll cursor for x1 open a70 fetch first a70 into p_test.* and only one prepare (of x1) at the beginning, and it did NOT reported any errors. So, declare does not count ? What *does* count for -257? I MUST reduce only prepare stmts.? What do I need to reduce to avoid max stmts err? I know I can re-use ID's in different moduls (up to V6), and I did. Yes, I know this makes me a bad boy. All in all, I have max of 2 prep's with same names in each modul (total of 15 moduls) and no more then 8 different declare ID names in any modul. So, only 2 different prep names and 8 different declare names (ID's) in *all* app! No can do. Still I get -257 under pre V5 engines. I want to avoid using FREE. I still have to support some V2 4gl compilers that does not have them. I can use only CLOSE. Andrej