Subject | Re: passing NULL using api |
---|---|
Author | blahclayton |
Post date | 2004-08-25T11:59:27Z |
Here is more info as requested:-
I prepare the following statement :-
UPDATE DATA_IN SET DATA_TEXT = ? WHERE Id = 1
where DATA_TEXT is a varchar(50) and Id is an integer
isc_erro_code = 335544569 (status[1]where status is a
ISC_STATUS_ARRAY returned from executing the statement).
I use Visual Studio 6.0 on windows and KDevlop 3.0 (uses gcc
compiler) on linux.
Here is what I actually do (if need more let me know):
start_transaction
allocate_statement
prepare_statement
unsigned int nSize = 1;
short nullid = 0;
XSQLDA* sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(nSize));;
sqlda->version = 1;
sqlda->sqld = nSize;
sqlda->sqln = nSize;
char* text = NULL;
for(unsigned int i = 0; i < nSize; i++)
{
if(text != NULL)
{
nullid = 0;
sqlda->sqlvar[i].sqldata = text;
}
else
{
sqlda->sqlvar[i].sqllen = 0;
nullid = -1;
}
// sets up each parameter
sqlda->sqlvar[i].sqltype = SQL_TEXT;
sqlda->sqlvar[i].sqlind = &nullid;
}
execute statement passing the sqlda created above
commit statement
Some example code that does work using example.fdb on linux will be
useful so I can prove it is a compiler problem.
Thanks for you help
Nina
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
I prepare the following statement :-
UPDATE DATA_IN SET DATA_TEXT = ? WHERE Id = 1
where DATA_TEXT is a varchar(50) and Id is an integer
isc_erro_code = 335544569 (status[1]where status is a
ISC_STATUS_ARRAY returned from executing the statement).
I use Visual Studio 6.0 on windows and KDevlop 3.0 (uses gcc
compiler) on linux.
Here is what I actually do (if need more let me know):
start_transaction
allocate_statement
prepare_statement
unsigned int nSize = 1;
short nullid = 0;
XSQLDA* sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(nSize));;
sqlda->version = 1;
sqlda->sqld = nSize;
sqlda->sqln = nSize;
char* text = NULL;
for(unsigned int i = 0; i < nSize; i++)
{
if(text != NULL)
{
nullid = 0;
sqlda->sqlvar[i].sqldata = text;
}
else
{
sqlda->sqlvar[i].sqllen = 0;
nullid = -1;
}
// sets up each parameter
sqlda->sqlvar[i].sqltype = SQL_TEXT;
sqlda->sqlvar[i].sqlind = &nullid;
}
execute statement passing the sqlda created above
commit statement
Some example code that does work using example.fdb on linux will be
useful so I can prove it is a compiler problem.
Thanks for you help
Nina
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
> At 07:27 AM 25/08/2004 +0000, you wrote:need
> >I have posted this issue before with little response and really
> >a solution as any help would be much appreciated.passing
> >
> >I have been using the firebird api (firebird 1.50 CS) to pass
> >input parameters to some statements. When I try and pass NULL as a
> >input parameter I get an SQL error (-804 - An
> >error was found in application input parameters for the SQL
> >statement!!) error on Linux.
> >
> >Has anybody come across the same problem?
>
> An -804 error to happen is caused by passing the wrong number of
> parameters, or by passing values of an unexpected data type, or by
> parameters to an unprepared statement.SQL
>
> What is the application that is giving you this error message? The
> code is a Firebird high-level error code, but the error messageisn't a
> Firebird one.problem, let
>
>
> >Is there a work around?
>
> You haven't provided enough information yet to pinpoint the
> alone provide a solution. Things that would help to get closer toit:
> 1) the declaration part of the stored procedureoccurs
> 2) the actual statement as presented to the API
> 3) the 9-digit isc error code that is returned when the exception
> 4) the compilers you used on Windows and Linux, respectivelyparameter
>
>
> >Does anybody have example code of passing NULL as an input
> >that works on Linux ?worked as
>
> The API is platform-neutral. If your source code compiled and
> expected on Windows but caused an exception condition when compiledand run
> on Linux, it would indicate some discrepancy between the compilers,someone has
> wouldn't it?
>
> > I am probably missing the obvious solution as I cannot believe
> > not tried to do this before.archive to
>
> People pass nulls in parameters all the time. Track back in the
> the examples Dmitry Sibiryakov and Ivan Prenosil gave you a fewdays ago.
> Show us some code..
>
> ./heLen