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 |colmuns| id = colmuns[0] nam = colmuns[2] email = colmuns[3] end end