Subject Re: [firebird-support] ISC_TIMESTAMP vs. Current Time
Author Kurt Federspiel
Hi, Helen & Alan.

Thanks for the API Guide Reference...

The double-quoted string is what is returning from the
DB. I am not using a where-clause between two dates.
I remember seeing another post that mentioned the
difference between single & double quotes, so I was
sure to check that (you must get annoyed making the
SAME comments day after day!! :).

At this point, I think I have an issue on how I'm
using the ISC_TIMESTAMP and the SQLDA, but I have seen
no examples of what to do so I'm hunting & pecking.

Apparently, there is an issue converting the sqlvar
datatype, but I have no clue what it is.

My query is:
select MAC, StartTime_Stamp, StopTime_Stamp from
Trends

The complete error message returned via
isc_interpret() is (NOTE: 5-MAY-2007 1:00:00.000 is
the StartTime data):
Dynamic SQL Error error code = -303 conversion error
from string \"5-MAY-2007 1:00:00.000\"

The Variables are defined as:
ISC_TIMESTAMP Start, Stop;

And the SQLVAR fields are set up as:
SQLDA1->sqlvar[1].sqldata = (char*)&Start;
SQLDA1->sqlvar[1].sqltype = SQL_TIMESTAMP;
SQLDA1->sqlvar[1].sqllen = sizeof(ISC_TIMESTAMP);

SQLDA1->sqlvar[2].sqldata = (char*)&Stop;
SQLDA1->sqlvar[2].sqltype = SQL_TIMESTAMP;
SQLDA1->sqlvar[2].sqllen = sizeof(ISC_TIMESTAMP);


Again, any help would be appreciated...I'm bumping a
deadline on this...

Kurt.


> --- Helen Borrie <helebor@...> wrote:
>
> At 10:06 AM 6/05/2007, you wrote:
> >Hi.
> >
> >I need to pull two dates from a table and compare
> them to the current
> >time. I keep getting an error that there is an
> illegal string
> >conversion of \"31-MAY-2007\", which is the date in
> the TIMESTAMP field.
> >
> >Below is a code fragment of what I'm attempting to
> do...any advice
> >would be appreciated....
>
> The expression
>
> where aTimestamp between '01-MAY-2007' and
> '31-MAY-2007'
>
> is valid (note the SINGLE quotes)
>
> while this expression
>
> where aTimestamp between ? and ?
>
> must receive timestamps in the parameters. (Date
> literals are
> literals, so passing them as parameters you are
> passing
> strings.) Your app has to pass the dates as a type
> that is
> compatible with TIMESTAMP.
>
> Reading the Beta IB6 API Guide pp. 167-170 would
> probably be useful
> for you to work out what you really need to pass in
> your xsqlvars
> (i.e. how to arrive at the tm struct you need).
>
> ./heLen
>


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com