Re: [gnome-db] SQLite provider and GdaTimestamp (4.2.2)



On 29 November 2010 18:41, Piotr Pokora <piotrek pokora gmail com> wrote:
> Hi!
>
> I have problem with GdaTimestamp values and SQLite provider.
> When GdaTimestamp value is set using gda_holder_set_value (),
> query is generated like:
>
> UPDATE tbl SET
>        col_a = '0001 01 01 00:00:00+0',
>        col_b = '2010 11 29 17:12:14+0'
>
> Query is executed, without error. Record is created.
> However, when I try to select this record, warning is thrown:
>
> Can't convert '   1-01-01 00:00:00' to a timestamp
>
> Why dashes are ignored for GdaTimestamp values?
>
> col_a = '0001-01-01 00:00:00+0' works fine, when I try it with SQLite
> directly.

I guess the  commit in
http://git.gnome.org/browse/libgda/commit/?id=a8336ee7576ac5ce74281ab9573798380049f97c
should fix this.

However I strongly encourage you to use variables in your SQL
statements (for example ##thedate::timestamp) instead of rendering SQL
directly before executing it:
- it is more efficient
- it avoids SQL injection problems.

Regards,

Vivien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]