Don't require the module if it isn't enabled.

This commit is contained in:
Cryptkeeper 2015-12-10 22:11:52 -06:00
parent 1120e7506b
commit 51bbb58146

@ -1,15 +1,15 @@
exports.setup = function() {
var sqlite = require('sqlite3');
var db = new sqlite.Database('database.sql');
db.serialize(function() {
db.run('CREATE TABLE IF NOT EXISTS pings (id INT AUTO INCREMENT PRIMARY KEY, timestamp BIGINT NOT NULL, ip TINYTEXT, player MEDIUMINT)');
});
exports.log = function(ip, timestamp, playerCount) {
var insertStatement = db.prepare('INSERT INTO pings (timestamp, ip, player) VALUES (?, ?, ?)');
insertStatement.run(timestamp, ip, playerCount);
};
exports.setup = function(fileName) {
db.serialize(function() {
db.run('CREATE TABLE IF NOT EXISTS pings (id INT AUTO INCREMENT PRIMARY KEY, timestamp BIGINT NOT NULL, ip TINYTEXT, player MEDIUMINT)');
});
};