Re: [gnome-db] INSERT statement with binary data





2009/1/20 Johannes Schmid <jhs jsschmid de>
Hi!

Thanks for your help. Anyway, I couldn't figure out how to construct
this query correctly from the examples as they seem to use methods from
gda-easy.c which are not available in the C++ bindings, yet
(http://bugzilla.gnome.org/show_bug.cgi?id=568484). If you could create
non-vararg versions it shouldn't be difficult.

You don't need the gda-easy functions:
* parse this statement: "INSERT INTO contacts (contact_id, ...) VALUES
(##contact_id::int, ##first_name::string, ...)" to get a GdaStatement
* obtain a GdaSet using gda_statement_get_parameters(): the new object will contain a GdaHolder for each variable in the statement (here: "contact_id", "first_name", ...)
* for each of the variables, give it a value using gda_holder_set_value (gda_set_get_holder  ())
* execute the statement using the GdaStatement and the GdaSet

After execution, the GdaSet and GdaStatement can be discarded or re-used as necessary. If you have several statement which use the same variable names, you can use the same GdaSet for all. If the same GdaStatement is reused, then it does not need to be re-parsed which improves performances a lot.

I'll add an example for this to the doc.

Sorry, I cannot attach the full query because it's a single long line
and it broke any editor I tried.

I'm interrested in the string you used to represent the binary data, you can truncate the binary data part.
 
Vivien



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