Subject | Re: [firebird-support] describe_bind |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2004-08-19T11:42:46Z |
On 19 Aug 2004 at 10:20, blahclayton wrote:
_describes_ them.
it as below. But not both.
Look at PARAM_VARY struct. VARCHAR has a short int actual length in
the beginning.
can coerce you text into needed form. Personally, I prefer to give to
server what it wants.
SY, Dimitry Sibiryakov.
>I am using isc_dsql_describe_bind() to bind all parameter as a char*You use it wrongly. describe_bind does not bind parameters. It
_describes_ them.
> unsigned int nSize = 1;BTW, change SQL_VARYING to SQL_TEXT.
> 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);You must either set up SQLDA by hands as above or ask server to do
> sqlda->sqlvar[i].sqlind = 0;
>
> }
it as below. But not both.
> if(isc_dsql_describe_bind(m_status, &stmt, nSize, sqlda))You don't understand what is internal representation of VARCHAR.
> {
> ThrowsError();
> }
>
>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?
Look at PARAM_VARY struct. VARCHAR has a short int actual length in
the beginning.
>I was hoping to pass all paramater types as char*In this case you have to use SQL_TEXT type ...and pray that server
can coerce you text into needed form. Personally, I prefer to give to
server what it wants.
>can I do this? can anyone give me tips/ example code? What do I do ISet null indicator to -1.
>do if I need to pass 'null'?
SY, Dimitry Sibiryakov.