Subject describe_bind
Author blahclayton
I am using isc_dsql_describe_bind() to bind all parameter as a char*


e.g. statement = UPDATE table_name SET col_name = ? WHERE ID = 1
where col_name is a varchar(50)


I do the following
start transaction,
allocate statement
prepare statement

I use the following code to bind and execute statment:-

unsigned int nSize = 1;
XSQLDA* sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(nSize));;
sqlda->version = 1;
sqlda->sqld = nSize;
sqlda->sqln = nSize;
char* text = "test";
for(unsigned int i = 0; i < nSize; i++)
{
printf("%s\n",aParam->Item(i));
// sets up each parameter
sqlda->sqlvar[i].sqldata = text;
sqlda->sqlvar[i].sqltype = SQL_VARYING;
sqlda->sqlvar[i].sqllen = strlen(text);
sqlda->sqlvar[i].sqlind = 0;

}

if(isc_dsql_describe_bind(m_status, &stmt, nSize, sqlda))
{
ThrowsError();
}

if (isc_dsql_execute(m_status, &trans, &stmt, 1, sqlda))
{
ThrowsError();
}
and then commit the transaction

I however get an error -804 - An error was found in application input
parameters for the SQL statement!!

What am I am doing wrong? Why does this not work?

If I use the following statement and set sqlda = NULL
UPDATE table_name SET col_name = 'test' WHERE ID = 1

It works!!!

I was hoping to pass all paramater types as char*
e.g.

TimeStamp type
char* szTime = "2004-08-18 10:00"

Id
char* szId = "1"

can I do this? can anyone give me tips/ example code? What do I do I
do if I need to pass 'null'?

Any help would be much appreciated?