Re: Errors 258 and 259
Posted in 2004
Steve Giles wrote:
> Richard Harnden <richard.harnden@lineone.net> wrote in message news:<40c706b3$0$6320$65c69314@mercury.nildram.net>...
>
>>Steve Giles wrote:
>>
>>
>>>Hello all,
>>>....
>>>
>>>
>>>>>Thanks in advance
>>>
>>>Steve.
>>
>>Maybe the cursor is being autofreed ?
>
>
> How can I determine that?
> I know there are no explicit free statements in the code. I've been
> examining some logs today and I can see the cursor being opened before
> the error, it's like the cursor just disappears.
Either you'd have an EXEC SQL SET AUTOFREE in your code, which you
obviously don't, or you'd know.
Or you have IFX_AUTOFREE set in the environment. Which I doubt your
customer would know about.
It frees the cursor/statement when the cursor is closed.
IFX_AUTOFREE is provided to break previously working apps ;)
$ cat test.ec
#include <stdio.h>
#include "sqlca.h"
int main(void)
{
int i;
EXEC SQL BEGIN DECLARE SECTION;
int count;
EXEC SQL END DECLARE SECTION;
EXEC SQL DATABASE sysmaster;
EXEC SQL PREPARE stmt FROM 'SELECT COUNT(*) FROM systables';
EXEC SQL DECLARE curs CURSOR FOR stmt;
for (i=0;i<2;i++)
{
printf("Loop %i\\n", i);
EXEC SQL OPEN curs;
if ( sqlca.sqlcode != 0 )
printf("Cannot open: %i\\n", sqlca.sqlcode);
EXEC SQL FETCH curs INTO :count;
if ( sqlca.sqlcode != 0 )
printf("Cannot fetch: %i\\n", sqlca.sqlcode);
else
printf("count = %i\\n", count);
EXEC SQL CLOSE curs;
}
return 0;
}
$ esql -o test test.ec
/usr/csdk_2_70_uc3/lib/esql/libifos.so: the use of `mktemp' isdangerous, better use `mkstemp'
$ IFX_AUTOFREE=1 ./test
Loop 0
count = 158
Loop 1
Cannot open: -404
Cannot fetch: -400
But, then, 404 and 400 isn't 258 nor 259.
--
rh