Re: DATABASE EXCLUSIVE Error
Posted in 1993
rob@dssmktg.com (Robert Minter) writes: > From Graeme Sargent: >* It also strikes me as strange that Robert is freeing the prepared >* statement, without closing or freeing the cursor. I doubt that this has >* any effect on the EXCLUSIVE problem, but it might be worth experimenting >* (I don't have a system to experiment with right now). > > Thanks for the input on our little problem here. I will put it to use. One > thing though, the manual states in the FREE definition, and I quote: > > Do not FREE a cursor-name that was DECLARED FOR statement-id. Use instead > FREE statement-id. Interesting! This quote seems to come from the I-4GL 4.00 Reference Manual. The I-4GL 4.10 Supplement says: Do not free a cursor-name that was declared for stmt-id. Instead, use FREE stmt-id. BUT also says (in the addmittedly slightly different context of an implicitly prepared statement: You should close the cursor before you use the FREE statement. The Guide to SQL: Reference 4.10 says: Do not free a statement associated with a cursor (either by naming the cursor or by naming a statement-id with which it is associated) unless the cursor is closed. ... The following INFORMIX-4GL example shows the sequence of statements used to release the resources of an explicitly prepared statement: PREPARE sel_stmt FROM ... DECLARE sel_curs CURSOR FOR sel_stmt OPEN sel_curs ... CLOSE sel_curs FREE sel_stmt The Guide to SQL: Reference December 1991 (ie 5.00) says: If you declared a cursor for a prepared statement, FREE statement id (or statement id variable) only releases the resources in the application development tool; the cursor can still be used. The resources in the database server are released only when you free the cursor. ... The following INFORMIX-4GL example shows the sequence of statements used to release the resources of an explicitly prepared statement: PREPARE sel_stmt FROM ... DECLARE sel_curs CURSOR FOR sel_stmt OPEN sel_curs ... CLOSE sel_curs FREE sel_stmt FREE sel_curs > > Is this in-correct or is FREEing both the cursor-name and the statement-id > a valid thing to do? Just inquiring... So I guess the answer is "It depends". I believe that the FREE statement has actually changed between 4.10 and 5.00. I suspect that it did not change (in this respect) between 4.00 and 4.10. Since you are using 4.10, I believe that you *should* be CLOSing the cursor before FREEing the statement, and that you *should not* be FREEing the cursor. Whether it is actually an error to vary from this ideal is not altogether clear, the documentation in this area does not leave one overflowing with confidence in its reliability. graeme -- Disclaimer: The author's opinions are his own, and not necessarily those of Pyramid Technology Ltd. or Pyramid Technology Inc. --------------------------------------------------------------------------- -m------- Graeme Sargent Voice: +44 (0)252 373035 ---mmm----- Senior Database Consultant Fax : +44 (0)252 373135 -----mmmmm--- Pyramid Technology Ltd. Telex: Tell who??? -------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk --------------------------------------------------------------------------- We have the technology. The tricky bit is learning how to use it.