From: James F.H. <jf...@ci...> - 2002-10-22 11:50:04
|
On Tue, 22 Oct 2002 07:06:25 -0400 James F.Hranicky <jf...@ci...> wrote: > There appears to be a bug in the string handling for either DBI#prepare > and DBI#execute, or else in the corresponding routines in the Pg driver. > > When attempting to insert a Windows pathname such as > > C:\this\is\a\path > > the backslash and the next char are getting interpolated as an escaped > character, leading to garbage being inserted into the table. I think I got it: *** /local/lib/ruby/site_ruby/1.7/dbi/sql.rb.orig Tue Oct 22 07:48:10 2002 --- /local/lib/ruby/site_ruby/1.7/dbi/sql.rb Tue Oct 22 07:46:34 2002 *************** *** 87,92 **** --- 87,93 ---- case value when String value = value.gsub(/'/, "''") # ' (for ruby-mode) + value.gsub!('\\\\', '\\\\\\\\') "'#{value}'" when NilClass "NULL" This seems to fix the problem. Jim |