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


OK, I finally got this working but I have a question on the data types.
If I pass something like

(##contact_id::int, ##first_name::string, ...)"

but contact_id has a value type GdaNumeric that libgda complains that
the data types do not match. Same when I passt first_name::varchar.
Shouldn't libgda handle such conversions itself?

Btw, I still think that those gda-easy methods are general useful also
in the C++ bindings.


Am Mittwoch, den 21.01.2009, 10:12 +0100 schrieb Vivien Malerba:
> 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
>         ( 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

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

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