Subject | Re: describe_bind |
---|---|
Author | blahclayton |
Post date | 2004-08-19T10:40:53Z |
Do you mean I need to call
isc_dsql_execute
and then
isc_dsql_describe_bind?
Have you got some example code?
Nina
--- In firebird-support@yahoogroups.com, "Ivan Prenosil"
<Ivan.Prenosil@s...> wrote:
isc_dsql_execute
and then
isc_dsql_describe_bind?
Have you got some example code?
Nina
--- In firebird-support@yahoogroups.com, "Ivan Prenosil"
<Ivan.Prenosil@s...> wrote:
> isc_dsql_describe_bind() will fill xsqlda structure,char*
> thus you must change it after that call.
>
> Ivan
>
> ----- Original Message -----
> From: "blahclayton" <ninaforum@n...>
> To: <firebird-support@yahoogroups.com>
> Sent: Thursday, August 19, 2004 12:20 PM
> Subject: [firebird-support] describe_bind
>
>
> >
> >
> > I am using isc_dsql_describe_bind() to bind all parameter as a
> >input
> >
> > 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
> > parameters for the SQL statement!!do I
> >
> > 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 if I need to pass 'null'?
> >
> > Any help would be much appreciated?
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >