[gnome-db] Prepared statements with libgda



Hi guys,

I've a problem with libgda queries and I cannot find any suitable
example that can explain me why these simple prepared statements don't
work. I hope you will do.

Well, suppose I have the following SQLite table:

CREATE TABLE workspace (workspace_id integer PRIMARY KEY AUTOINCREMENT,
name varchar (50) not null unique,
analize_time DATE
);

I successfully created a connection to the database, then I want to add
a row into this table:

GdaDict *dict;
GdaQuery *query;

dict = gda_dict_new ();
gda_dict_set_connection (dict, db_connection);
gda_dict_load (dict, NULL);

query = gda_query_new_from_sql (dict,
"INSERT INTO workspace (analize_time, name) VALUES (datetime('now'),
##/* name:'+0' type:'gchararray' */)", NULL);


it seems all ok but I got this error on runtime

GdaHandlerTime 0x8052800
locale order = Month Day Year, separator = /
locale has 2 digits year, using 2000 as offset

** ERROR **: file gda-query-parsing.c: line 1647
(parsed_create_value_query_field): assertion failed: (gdatype !=
G_TYPE_INVALID)


Note: if I create that query without 'analize_time' and the
"datetime('now')" part, I got the query committed in the database, after
parameter setting of course..
What's going wrong?


thanks and regards,

Massimo

 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Prestiti e Finanziamenti con un semplice click, scopri subito se sei
finanziabile cliccando qui
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2910&d=20070323





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