var mysql = require('mysql');
var config = require('./confLoader.js');

config.load();

var dbConf = config.get('db');

var database = function(){
	this.conf = dbConf;
}

database.prototype.connect = function(){
	var self = this;
	self._con = mysql.createConnection(self.conf);
}

database.prototype.formatQuery = function(str, arr){
	return mysql.format(str, arr);
}

database.prototype.query = function(query, cb){
	var self = this;
	self._con.query(query,cb);
}

database.prototype.close = function(){
	this._con.end();
}

module.exports = database;
