Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'mysql2'
- require 'mysql2-cs-bind'
- # Mysqlドライバの設定
- db = Mysql2::Client.new(
- host: 'localhost',
- port: 3306,
- username: 'root',
- password: '',
- database: 'sample',
- reconnect: true,
- )
- result = db.xquery("SELECT * FROM infos")
- infos = result.to_a
- puts infos[0]["name"]
Add Comment
Please, Sign In to add comment