Looks like attached patch solves an issue. It defines Row#dup not only
for 1.8, but for 1.9 too. Row#clone for 1.9 was defined just for "let
it be", I'm not sure that it's really required.

Output for the same SQLite3 file:

$ ruby1.9.1 testdbi.rb
Ruby version: 1.9.2
DBI driver: SQLite3
[[2, "moderator"], [22, "moderator"]]

It works.

-- 
http://375gnu.wordpress.com
diff -uNr dbi-0.4.3.orig/lib/dbi/row.rb dbi-0.4.3/lib/dbi/row.rb
--- dbi-0.4.3.orig/lib/dbi/row.rb	2009-06-27 12:26:50.000000000 +0300
+++ dbi-0.4.3/lib/dbi/row.rb	2011-05-21 15:14:08.000000000 +0300
@@ -217,6 +217,22 @@
             def __setobj__(obj)
                 @delegate_dc_obj = @arr = obj
             end
+
+            def clone
+                marshal_load(marshal_dump)
+            end
+
+            def dup
+                row = self.class.allocate
+                row.instance_variable_set :@column_types,  @column_types
+                row.instance_variable_set :@convert_types, @convert_types
+                row.instance_variable_set :@column_map,    @column_map
+                row.instance_variable_set :@column_names,  @column_names
+                # this is the only one we actually dup...
+                row.__setobj__ @arr.dup
+                row
+            end
+
         else
             #
             # See Object#clone.

Reply via email to