Ruby
提供: sha.ngri.la
MySQLを使う
$ gem install mysql
id | name | |
---|---|---|
1 | foo baa | baa@***.com |
2 | ofo abaa | abaa@***.com |
3 | oof aab | aab@***.net |
fooo.rb
require 'mysql' begin db = Mysql::connect('localhost','username','password','database') sql = "select * from tablename" rs = db.query sql rs.each do |columns| id = columns[0] nam = columns[2] email = columns[3] end end