class Infrataster::Contexts::MysqlQueryContext
Public Instance Methods
results()
click to toggle source
# File lib/infrataster/contexts/mysql_query_context.rb, line 7 def results options = {port: 3306, user: 'root', password: ''} if server.options[:mysql] options = options.merge(server.options[:mysql]) end server.forward_port(options[:port]) do |address, new_port| mysql_options = { host: address, port: new_port, username: options[:user], password: options[:password] } if options.key?(:database) mysql_options[:database] = options[:database] end client = Mysql2::Client.new(mysql_options) client.xquery(resource.query, *resource.params) end end