2009/1/20 Johannes Schmid <[email protected]>

> Hi!
>
> I am trying to fix a bug in glom where it tries to insert binary data (a
> png image) using an INSERT statement. SqlParser reports that the
> statement is malformed but I couldn't figure out how to fix that. The
> statement is basically:
>
> INSERT INTO "contacts" ("contact_id", "name_first", "name_middle",
> "name_last", "name_title", "address_street", "address_town",
> "address_state", "address_country", "address_postcode", "date_of_birth",
> "comments", "name_full", "picture", "email", "website", "tel_home",
> "tel_work", "tel_mobile", "tel_fax") VALUES
> (0,'Murray','','Cumming','Mr','Falschstrasse
> 123','Munich','Bavaria','Germany','D-80798','1973-05-11','','Murray
> Cumming', '<no a lot of binary data follows>',
> '','www.murrayc.com','','','','')
>
>
> The binary data looks about like this: \\362\\377\\001NIU\\225\\016\\376
> \\034\\350\\000\\000\\000\\000IEND\\256B`\\202 (just an example.
>
> How does this data need to be encoded so that GdaSqlParser is happy with
> it?


Can you send me the exact string you need to parse?

As a side remark: creating a SQL string containing values literals is not
the way to go: use variables instead which have the double benefit of making
statement execution faster (the statement is parsed only once) and prevents
SQL injection problems. Please see
http://library.gnome.org/devel/libgda/unstable/GdaSqlParser.html#GdaSqlParser.descriptionand
http://library.gnome.org/devel/libgda/unstable/main_example.html for some
code example.

Vivien


>
>
> Thanks,
> Johannes
>
>
> _______________________________________________
> gnome-db-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gnome-db-list
>
>
_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Reply via email to