From: Volker W. <po...@vo...> - 2004-09-03 19:02:07
|
Hi I've investigated the bug which I've reported, concerning binary data. This is the SQL query generated when the string (map chr [0..255]) is inserted into my table: INSERT INTO wert (kennung, typ, daten) VALUES (1, 1, '\NUL\SOH\STX\ETX\EOT\ENQ\ACK\a\b\t\n\v\...<snip>...\238\239\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255') It is generated by the following function in Sql.hs. The function makes a component of a Doc, which is later pretty printed to produce the SQL query. ppInsert :: SqlInsert -> Doc ppInsert (SqlInsertQuery table select) = text "INSERT INTO" <+> text table $$ ppSql select ppInsert (SqlInsert table exprs) = text "INSERT INTO" <+> text table <+> parens (vcat $ punctuate comma (map text names)) $$ text "VALUES" <+> parens (vcat $ punctuate comma (map text values)) where (names,values) = unzip exprs The problem is the (map text values) part. Unusual characters are escaped by Text.PrettyPrint.HughesPJ, which does it the wrong way. The SQL server doesn't understand the syntax produced. The problem doesn't affect only binary data, but also printable eight bit characters. No attempt is made by HaskellDB to properly escape strings when composing an SQL query. Sql.hs needs to be rectified, and I'm willing to do that. I'm about to make the corrections to version 0.8 and send a patch. Is HaskellDB being maintained? Judging from the web page, there is development, but is any of the developers reading this mailing list ??? Please send me a note. >>> And please add a note to the HaskellDB homepage, informing the potential user that HaskellDB isn't fit for use right now. <<< Cheers, V.W. -- Volker Wysk <po...@vo...> http://www.volker-wysk.de |