[erlang-questions] String and single quote escaping

David Welton davidnwelton@REDACTED
Wed Oct 8 17:10:18 CEST 2014


> Now, i have to create a string that will be passed as query to a sqlserver
> so i need to escape the single quote. To do this i’m using re:replace for
> example with these syntax :

I would be careful with that.  One approach might be to use something
like Postgres' prepared statements, so you do:

pgsql:equery(C, "select * from foobar where foo = $1", [Foo])

That way it's the database itself that handles any tricky quoting
issues.  I think most databases have something like this.

Ciao,
-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/



More information about the erlang-questions mailing list