Created
August 1, 2016 20:43
-
-
Save zyriuse75/bdc53d7292b22752c15125f668e6956a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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