db.js
/**
 * Execute SQL query on the connection object that is provided.
 * @param {*} database sqlite3 database/connection object
 * @param {*} query SQL to be executed
 * @returns A new promise
 */
Execute SQL query on the connection object that is provided.
@param {*} database sqlite3 database/connection object
@param {*} query SQL to be executed
@returns A new promise
Execute SQL query on the connection object that is provided . @param { * } database sqlite3 database / connection object @param { * } query SQL to be executed @returns A new promise
function dbPromiseExecSQL(database, query) {
  return new Promise((resolve, reject) => { database.all(
    query, 
    function (err, rows) {
      if (err) reject(err); 
      else resolve(rows); 
    }
  )});
}
function dbPromiseExecSQL ( database , query ) { return new Promise ( ( resolve , reject ) => { database . all ( query , function ( err , rows ) { if ( err ) reject ( err ) ; else resolve ( rows ) ; } ) } ) ; }
Execute SQL query on the connection object that is provided.
Execute SQL query on the connection object that is provided .
// Run the SQL query // Reject promise if there is an error // Fulfill promise with data if there is no error