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

Vivien Malerba <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <[email protected]>
On 29 November 2010 18:41, Piotr Pokora <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.