Class: Mysql

Inherits:
Object
  • Object
show all
Defined in:
lib/adapters/mysql.rb

Instance Method Summary collapse

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