lpsmith / postgresql-libpq

Low-level Haskell bindings for libpq
BSD 3-Clause "New" or "Revised" License
19 stars 18 forks source link

expose PQescapeLiteral #16

Closed ibotty closed 10 years ago

ibotty commented 10 years ago

it would be great to have PQescapeLiteral.

I guess you haven't already figured out what to do with pvp (#8) in that case. i would prefer to include a dummy implementation if libpq does not include it, that filters out too much (err on the safe side).

having said that, postgresql 8.4 (the last supported version missing it) is eol in june this year, which is not that far off.

ibotty commented 10 years ago

just a note, that that would make it possible to fix lpsmith/postgresql-simple#65 properly.

lpsmith commented 10 years ago

Yeah, I agree completely. I fully support adding a binding for PQescapeLiteral right now, without waiting.

lpsmith commented 10 years ago

Err, actually we need PQescapeIdentifier. PQescapeLiteral appears to just be a variation on PQescapeStringConn, do you know of any particular difference that really matters?

lpsmith commented 10 years ago

(honestly though, I do see some arguments for implementing escaping ourselves, especially if properly integrated with bytestring builder. Still, that is not something I'm terribly enthusiastic about.)

lpsmith commented 10 years ago

Ok, fixed by 9966598852fc31cc1fad7c3b2833362fb65af20b

lpsmith commented 10 years ago

Hmm, after a reading of the source of postgresql-libpq, I'm actually fairly confident that with a bit more investigation, that it would be quite doable to implement both identifier and value escaping in Haskell, which would probably be a performance boost for things like postgresql-simple.

This is probably beyond the scope of postgresql-libpq, however.