From: KAWAJI S. <ka...@ho...> - 2002-08-10 16:59:47
|
Brad Hilton <bh...@vp...> wrote: > The mysql driver quotes \ as: > > '\\' > > 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) --- Pg.rb.bak Sun Aug 11 01:54:34 2002 +++ Pg.rb Sun Aug 11 01:54:34 2002 @@ -304,6 +304,15 @@ @connection.exec(sql) end + def quote(value) + case value + when String + "'#{ value.gsub(/\\/){ '\\\\' } }'" + else + super + end + end + private # ---------------------------------------------------- def initialize_autocommit SEE ALSO: Perl's DBD::Pg http://search.cpan.org/author/JBAKER/DBD-Pg-1.13/Pg.pm#quote -- Shinya Kawaji |