Class: Mysql
- Inherits:
-
Object
- Object
- Mysql
- Defined in:
- lib/adapters/mysql.rb
Instance Method Summary collapse
- #fields(table) ⇒ Object
-
#initialize(details, show_sql = false) ⇒ Mysql
constructor
A new instance of Mysql.
- #query(sql) ⇒ Object
Constructor Details
#initialize(details, show_sql = false) ⇒ Mysql
Returns a new instance of Mysql.
5 6 7 8 |
# File 'lib/adapters/mysql.rb', line 5 def initialize(details,show_sql=false) @client = Mysql2::Client.new(details) @show_sql = show_sql end |
Instance Method Details
#fields(table) ⇒ Object
15 16 17 |
# File 'lib/adapters/mysql.rb', line 15 def fields(table) query('select * from ' + table.to_s).fields end |
#query(sql) ⇒ Object
10 11 12 13 |
# File 'lib/adapters/mysql.rb', line 10 def query(sql) puts sql if @show_sql @client.query(sql) end |