Onderwerp:7 vs 9
Posted in 2004
Topics: General Discussion
Sounds like you have been exploiting a bug: -- $EXECUTE IMMEDIATE "CREATE TEMP TABLE lvo ( i INT, f char( 16 ) ) -- WITH NO LOG"; -- $EXECUTE IMMEDIATE "INSERT INTO lvo VALUES ( 1, 'A' )"; -- $DECLARE sel CURSOR WITH HOLD FOR SELECT f INTO :f FROM lvo; -- $OPEN sel; -- $FETCH sel; i would close and free the cursor here!!!!!!! -- $EXECUTE IMMEDIATE "ROLLBACK"; -- $EXECUTE IMMEDIATE "BEGIN WORK"; -- $EXECUTE IMMEDIATE "CREATE TEMP TABLE lvo ( id INT ) WITH NO LOG"; --$EXECUTE IMMEDIATE "CREATE INDEX lvo ON lvo( id )"; what happens when you try to fetch again or close again from cursor sel... i expect a Barf out the engine.....(7 that is...) Superboer.
superboer wrote: > Sounds like you have been exploiting a bug: $EXECUTE IMMEDIATE "BEGIN WORK"; -- omitted from Superboer's response! > -- $EXECUTE IMMEDIATE "CREATE TEMP TABLE lvo ( i INT, f char( 16 ) ) > -- WITH NO LOG"; > -- $EXECUTE IMMEDIATE "INSERT INTO lvo VALUES ( 1, 'A' )"; > -- $DECLARE sel CURSOR WITH HOLD FOR SELECT f INTO :f FROM lvo; > -- $OPEN sel; > -- $FETCH sel; > > i would close and free the cursor here!!!!!!! > > -- $EXECUTE IMMEDIATE "ROLLBACK"; But the rollback here closes the cursor - it doesn't free it, but it does close it. The rollback should destroy the temporary table. This renders this cursor unusable - it should be freed. > -- $EXECUTE IMMEDIATE "BEGIN WORK"; > -- $EXECUTE IMMEDIATE "CREATE TEMP TABLE lvo ( id INT ) WITH NO LOG"; > --$EXECUTE IMMEDIATE "CREATE INDEX lvo ON lvo( id )"; The error reported is -242 (Could not open database table), and -106 (non-exclusive access). Since this is a new table, it is not obvious that the sel cursor should be regarded as referring to it. However, to find out whether there is something devious going on, it would be worth (closing and) freeing the declared cursor. If the code then works, we've got an abstruse bug; if the code still fails, we probably have a more serious (less abstruse) bug to deal with. > what happens when you try to fetch again or close again from cursor sel... > > i expect a Barf out the engine.....(7 that is...) You should get a -710 (Table has been dropped, altered or renamed). -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/