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

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

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
Cumming', '<no a lot of binary data follows>',

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

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 and for some code example.



gnome-db-list mailing list
gnome-db-list gnome org

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