Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Problem with ruby-dbi-all-0.0.20 and/or ruby-1.8.0
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Brian Candler, post: 4413101"] The following test program works correctly with ruby-dbi-all-0.0.18 under ruby-1.6.8, but not ruby-dbi-all-0.0.20 under ruby-1.8.0: ------------------------------------------------------------------ #!/usr/local/bin/ruby -w require 'dbi' LIMIT = 100 d = DBI.connect('dbi:Mysql:somedatabase','root','') sql = "select col1,col2 from anytable" rows = [] d.execute(sql) do |sth| loop do row = sth.fetch p row # prints the right answer break if row.nil? rows << row.dup break if rows.size >= LIMIT end end p rows # prints the wrong answer ------------------------------------------------------------------ The problem is that the array 'rows' contains the last row repeated N times, instead of N different rows. This is despite the use of 'row.dup'. The object_id's of the elements of row are all different, but the contents are the same. I used mysql-ruby-2.4.4 in both cases. Regards, Brian. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Problem with ruby-dbi-all-0.0.20 and/or ruby-1.8.0
Top