Module: Backups::Driver::Mysql
- Included in:
- Stats::Mysql
- Defined in:
- lib/backups/driver/mysql.rb
Instance Method Summary collapse
Instance Method Details
#connect ⇒ Object
7 8 9 10 |
# File 'lib/backups/driver/mysql.rb', line 7 def connect @connection[flags: Mysql2::Client::MULTI_STATEMENTS] @mysql = Mysql2::Client.new(@connection) end |
#exec_query(sql) ⇒ Object
12 13 14 15 16 |
# File 'lib/backups/driver/mysql.rb', line 12 def exec_query(sql) return puts sql if $dry_run connect if not @mysql @mysql.query sql end |
#get_result(sql) ⇒ Object
28 29 30 31 |
# File 'lib/backups/driver/mysql.rb', line 28 def get_result(sql) rows = get_results(sql) return rows[0] end |
#get_results(sql) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/backups/driver/mysql.rb', line 18 def get_results(sql) return [] if not rset = exec_query(sql) rows = [] rset.each do |row| rows << row end return rows end |