Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x | module.exports = class Dao { constructor(pool) { // Dependency Injection this.pool = pool; } query(sql, params, callback) { this.pool.getConnection((err, connection) => { console.log("dao: connected to database"); Iif (err) { console.log("dao: error connecting"); callback(500, { error: "feil ved ved oppkobling" }); } else { console.log("dao: running sql: " + sql); connection.query(sql, params, (err, rows) => { connection.release(); Iif (err) { console.log(err); callback(500, { error: "error querying" }); } else { console.log("dao: returning rows"); callback(200, rows); } }); } }); } }; |