Subject Re: [firebird-support] Timestamp variable with fractional seconds
Author Milan Babuskov
Helen Borrie wrote:
>>How to do this in a compiled statement using a timestamp column, and
>>IBPP if possible (unless there is a class library that is more
>>favored; I like IBPP even with the gaps in documentation)?
>>
> If you're getting exceptions from CASTS, it is almost certainly due to
> passing a date literal in a format not recognised by Firebird. There's a
> big section about date literals in Ch. 10. While there's quite a big range
> of possible formats for the date part, you still must use one that is
> recognised. A common gotcha is using 'dd/mm/ccyy' for the date part. For
> the time part, it will accept only one format, that is 'hh:nn:ss.nnnn'
> (24-hour clock). If conjoined to a time part, there *must* be a leading
> space character on the time part.
>
> IBPP is just a wrapper for the API so I can't see how it could interfere
> with your SQL statement strings.

If he's using parameters he should take care since IBPP is very rigid
about this, for example, if you wish to insert into date field you
can't do something like:

string s = "07.02.2005";
statement->Set(1, s);

Even thought there is Statement::Set(int, string), it won't work since
it expects the argument to be of IBPP::Date type.

I don't know what is IBPP's behaviour if one does: "INSERT INTO xyz
VALUES (cast(? as timestamp)". I guess it throws it away as invalid.

I think this should go to IBPP mailing list for detailed discussion. I
would also be good to read what error does IBPP give.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org