Add (forcefully -f) database.js. Git no pickup
Git didn't pickup the database.js file in status/diff/add so it was missing. Thankfully noticed not long after the commitdevelop
parent
bf5cfdf16c
commit
469fc8838f
@ -0,0 +1,35 @@
|
|||||||
|
const mysql = require('mysql');
|
||||||
|
const con = mysql.createConnection({
|
||||||
|
host: "localhost",
|
||||||
|
user: "realmsdivided",
|
||||||
|
password: "realmsdivided",
|
||||||
|
database: "realms_divided"
|
||||||
|
});
|
||||||
|
|
||||||
|
function connect(){
|
||||||
|
con.connect(function(err) {
|
||||||
|
if (err) { console.log(err); }
|
||||||
|
else { console.log('DB Connected'); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function disconnect(){
|
||||||
|
con.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCards(additionalData){
|
||||||
|
const cPromise = new Promise((resolve, reject) => {
|
||||||
|
let sql = 'SELECT * FROM card';
|
||||||
|
if(additionalData){ sql = sql + " WHERE "+additionalData; }
|
||||||
|
|
||||||
|
con.query(sql, function (err, result, fields) {
|
||||||
|
if (err) { throw err; reject(new Error(err)); }
|
||||||
|
resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return cPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
connect, disconnect
|
||||||
|
, getCards
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue