You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
351 B
23 lines
351 B
require 'mysql2'
|
|
require 'singleton'
|
|
|
|
class DatabaseConnection
|
|
include Singleton
|
|
|
|
def initialize
|
|
@client = Mysql2::Client.new(
|
|
host: 'localhost',
|
|
username: 'project_user',
|
|
password: 'project_password',
|
|
database: 'project_db'
|
|
)
|
|
end
|
|
|
|
def client
|
|
@client
|
|
end
|
|
|
|
def query(sql)
|
|
@client.query(sql)
|
|
end
|
|
end |