Created
March 13, 2013 13:14
-
-
Save mironov/5151929 to your computer and use it in GitHub Desktop.
ruby-dbi fix for 1.9.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
However I couldn't fix the encoding issue on 1.9.3 and switched to mysql2.