databases icon indicating copy to clipboard operation
databases copied to clipboard

Week3 Exercise 3 improvements

Open tomasvanrijsse opened this issue 4 years ago • 0 comments

By week 3 the students are used to work with the promisified execQuery.

The exercise could be upgraded so there are less questions about the weirdness / old school approach.

const execQuery = util.promisify(connection.query.bind(connection));

async function getPopulationFromCountry(name, code) {
  // assuming that connection to the database is established and stored as conn
  return execQuery(
    `SELECT Population FROM `country` WHERE Name = '${name}' and code = '${code}'`
  );
}

tomasvanrijsse avatar Mar 08 '21 12:03 tomasvanrijsse