The way to get AffectedRows when non-Async is shown here: https://github.com/mysqljs/mysql/issues/363
My Code below - none of the console.logs after the update display in the console, certain columns are not being updated in the database, and no error or try catch is encountered. If there's an error, why don't I see it, otherwise, why don't I see the AffectedRows?
This is being called from another async function.
async function UpdatePassword(connection, rowID) {
... some code omitted here...
try
{
var [errQuery,results] = await
connection.query(sqlUpdate);
if (errQuery) throw errQuery;
console.log("Back from update");
console.log("AffectedRows=" + results.affectedRows);
} catch (err)
{
console.log("*** Catch Error:")
console.log(err.stack);
}
}
I think I have improved the code, but same issue. Non error, no console.log statements after the connection.query show up.
console.log("SQL Update=" + sqlUpdate);
try
{
var [rows, fields, errQuery] = await connection.query(sqlUpdate);
if (errQuery) throw errQuery;
console.log("Back from update");
console.log("AffectedRows=" + rows.affectedRows);
} catch (err2)
{
console.log("*** Catch Error:")
console.log(err2.stack);
}
console.log ("end function");