Bug #2409
closedmysql
Description
=begin
The following two files, when run on Windows Vista, execute properly half the time and break Ruby the other half. All it does is print the number of columns in each row returned in the result set. I'm using Ruby 1.9.1 installed from 'rubyinstaller-1.9.1-p243-rc1.exe'.
SQLTest.rb: START -------------------------------------------------------------
This code presumes the existence of 2 mysql tables named teacher and student. Table 'teacher' has a¶
primary key of 'tid' and 'year', both ints, plus additional info like name, etc. Table 'student' has¶
a foreign key, to table 'teacher', also of 'tid' and 'year', plus additional student information.¶
require 'DBCtrl'
dbCtrl = DBCtrl.new
dbh = dbCtrl.connect
rs = dbh.query("describe student")
dbCtrl.showResultSet(rs)
rs.free
dbCtrl.disconnect(dbh)
dbh = dbCtrl.connect
rs = dbh.query("show indexes from student")
dbCtrl.showResultSet(rs)
rs.free
dbCtrl.disconnect(dbh)
SQLTest.rb: END ---------------------------------------------
DBCtrl.rb: START -------------------------------------------
require 'mysql'
class DBCtrl
def connect
dbh = Mysql.connect('localhost', 'Axel', 'F1f1look', 'binkDB')
end
def disconnect( dbh )
dbh.close
end
def showResultSet( rs )
if !rs.nil?
rs.each do |arr|
puts arr.length
end
puts
end
end
end
DBCtrl.rb: END -------------------------------------
=end
Updated by naruse (Yui NARUSE) over 14 years ago
- Status changed from Open to Third Party's Issue
- ruby -v set to rubyinstaller-1.9.1-p243-rc1.exe
=begin
This is not Ruby's issue.
Report to rubyinstaller.
=end