Update of /cvsroot/ruby-dbi/src/lib/dbd_pg
In directory usw-pr-cvs1:/tmp/cvs-serv32532
Modified Files:
Pg.rb
Log Message:
fix quoting backslashes bug (Brad Hilton)
Index: Pg.rb
===================================================================
RCS file: /cvsroot/ruby-dbi/src/lib/dbd_pg/Pg.rb,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Pg.rb 26 Jul 2002 17:56:43 -0000 1.23
+++ Pg.rb 13 Sep 2002 09:10:31 -0000 1.24
@@ -303,8 +303,18 @@
puts "SQL TRACE: |#{sql}|" if @debug_level >= level
@connection.exec(sql)
end
+
+ def quote(value)
+ case value
+ when String
+ "'#{ value.gsub(/\\/){ '\\\\' }.gsub(/'/){ '\\\'' } }'"
+ else
+ super
+ end
+ end
+
- private # ----------------------------------------------------
+ private # ----------------------------------------------------
def initialize_autocommit
@autocommit = true
@@ -411,11 +421,9 @@
################################################################
class Statement < DBI::BaseStatement
- include SQL::BasicQuote
-
def initialize(db, sql)
@db = db
- @prep_sql = DBI::SQL::PreparedStatement.new(self, sql)
+ @prep_sql = DBI::SQL::PreparedStatement.new(@db, sql)
@result = nil
@bindvars = []
end
|