MySQL Forums
Forum List  »  Ruby

Segmentation error
Posted by: Jim Burgess
Date: January 07, 2009 04:11PM

The following code works perfectly when using mysql 5.0.67, but since upgrading to mysql 5.1 I receive an error message "undefined method for 'fetch_row'
Can anyone tell me why and how I can get round this?

require 'mysql'
con = Mysql.new('localhost', 'root', 'pass', 'db')
res = con.query('select * from bands')
while row = res.fetch_row
0.upto(row.length-1) do |i|
puts "#{row}"
end
puts
end
res1 = con.query('select * from bands where band = "Led Zep"')
while row = res1.fetch_row
0.upto(row.length-1) do |i|
puts "#{row}"
end
puts
end
con.close

Also, using mysql 5.0.67 I can open several connections the database (one after another). With mysql 5.1 this gives me a segmentation error and tells me to contact the development team.

Is this a fault with mysql 5.1, or with the ruby bindings?

Is there any kind of different syntax to be aware of when using mysql 5.1?

I am grateful for any help you can give



Edited 2 time(s). Last edit at 01/07/2009 04:13PM by Jim Burgess.

Options: ReplyQuote


Subject
Written By
Posted
Segmentation error
January 07, 2009 04:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.