Skip to content

Instantly share code, notes, and snippets.

@zyriuse75
Created August 1, 2016 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyriuse75/df64fdbf3ff03573849c23d2e4ef69ff to your computer and use it in GitHub Desktop.
Save zyriuse75/df64fdbf3ff03573849c23d2e4ef69ff to your computer and use it in GitHub Desktop.
class StreamMysql
def initialize
read_config_file
end
def mysql_connection
puts "mysql_connection"
@connexion = Mysql2::Client.new(:host => @conf['host'], :username => @conf['user'], :password => @conf['password'], :database=> @conf['base'], :port => @conf['port'])
# @connexion.query if @connexion
# if @connexion
#
# end
end
def mysql_select(value = "*")
puts "select"
if mysql_connection then
mysql_connection.query("select #{value} from User")
else
end
end
def read_config_file
config = YAML::load_file(File.join(__dir__, 'config.yml'))
@conf = config['database']
end
end
StreamMysql.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment