On Sat, 2002-08-10 at 09:59, KAWAJI Shinya wrote:
> > The pg driver quotes it as:
> >
> > '\'
> Because, dbd_mysql define an own quote method (MySQL's API is used),
> but dbd_postgres does not (Postgres's API dosen't have 'quote').
>
> Try this patch.(untested)
Sorry to take so long to reply. The patch solves the '\' problem, but
doesn't escape single quotes. I had to add a quote method like:
def quote(value)
case value
when String
"'#{ value.gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'"
else
super
end
end
That solved the quoting problems for me.
It would be great if someone could apply the patch to Pg.rb, or better
yet, if the ruby-postgres driver could be patched to use the internal
quoting mechanism provided by the postgres client libraries.
Thanks,
-Brad
|