All files dao.js

72.73% Statements 8/11
50% Branches 2/4
100% Functions 4/4
72.73% Lines 8/11
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 30 31 32 33 34 35 36 371x       1x             6x   6x           6x   6x 6x             6x              
module.exports = class Dao
{
	constructor(pool)
	{
		this.pool = pool;
	}
 
 
 
	query(sql, params, callback)
	{
		this.pool.getConnection((err, connection) =>
		{
			Iif (err)
			{
				callback(500, {error: "feil ved get connection"});
			}
			else
			{
				connection.query(sql, params, (err, rows) =>
				{
					connection.release();
					Iif (err)
					{
						console.log(err);
						callback(500, {error: "error querying"});
					}
					else
					{
						callback(200, rows);
					}
				});
			}
		});
	}
};