Subject linux and pass NULL
Author blahclayton
I have been using the firebird api (firebird 1.50 CS) to pass
parameters to some statements. I need to pass NULL for one of the
parameters. My code works fine under windows, unfortunately when I
use the same code (see below) in Linux I get an SQL error (-804 - An
error was found in application input parameters for the SQL
statement!!).

Has anybody come across the same problem?

Is there a work around?

Am doing something wrong (see code below)?


allocate statement
start transaction
prepare statement


char* text = NULL;
unsigned int nSize = 1;
XSQLDA* sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(nSize));;
sqlda->version = 1;
sqlda->sqld = nSize;
sqlda->sqln = nSize;
for(unsigned int i = 0; i < nSize; i++)
{

sqlda->sqlvar[i].sqltype = SQL_TEXT;
// sets up each parameter
if(text != NULL)
{

sqlda->sqlvar[i].sqldata = text;
sqlda->sqlvar[i].sqllen = strlen(text);
sqlda->sqlvar[i].sqlind = 0;

}
else
{
sqlda->sqlvar[i].sqllen = 0;
sqlda->sqlvar[i].sqlind = (short*)-1;
}

}



execute statement passing sqlda
commit transaction

Thanks in advance