-
-
Save zyriuse75/df64fdbf3ff03573849c23d2e4ef69ff 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