Skip to content

Instantly share code, notes, and snippets.

@mironov
Created March 13, 2013 13:14
Show Gist options
  • Save mironov/5151929 to your computer and use it in GitHub Desktop.
Save mironov/5151929 to your computer and use it in GitHub Desktop.
ruby-dbi fix for 1.9.3
module DBI
class Row
#
# See Object#clone.
#
# #clone here, however, is a deep copy via Marshal.
#
def clone
Marshal.load(Marshal.dump(self))
end
#
# #dup is only a shallow copy
#
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.instance_variable_set :@arr, arr = @arr.dup
row.instance_variable_set :@_dc_obj, arr
row
end
end
end
@mironov
Copy link
Author

mironov commented Mar 23, 2013

However I couldn't fix the encoding issue on 1.9.3 and switched to mysql2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment