Re: CLOSE and FREE
Posted in 1995
I never got any explanation of why this program works:
> johnl@informix.com (Jonathan Leffler) wrote:
> > >Subject: Re: CLOSE and FREE
>
> > So, CLOSE indicates that the cursor is not needed for the time being.
> [snip]
> > To indicate that you have no further interest in the cursor at
> > all, you FREE the cursor.
>
> So shouldn't this sample program NOT work? (Because it does on our 4.10.UC1
> 4GL-RDS and 5.02.UC2 SE system):
> ---------------------------------
> MAIN
> DEFINE i SMALLINT,
> l_tabname CHAR(18)
>
> DATABASE yourdatabase -- You'll want to change this
>
> DECLARE test_curs CURSOR FOR
> SELECT tabname
> FROM systables>
> FOR i = 1 TO 2
> OPEN test_curs -- Shouldn't this line barf on the 2nd iteration?
> FETCH test_curs INTO l_tabname
> DISPLAY "i = ", i, " ", l_tabname
> CLOSE test_curs
> FREE test_curs
> END FOR
>
> END MAIN
Regards,
Kerry S (who's desperately trying to get excited about FREE)
--------------------------------------,-------------------------------------
Kerry Sainsbury, kerry@kcbbs.gen.nz | THE INFORMIX FAQ
Quanta Systems, Auckland, New Zealand | kcbbs.gen.nz:/informix/*
| mathcs.emory.edu:/pub/informix/faq/*
+64 9 377-4473 (work) 276-5546 (home) | quasar.ucar.edu:/?