try {
const sql = `
SELECT
total_count ,
current_count
FROM
content_test
WHERE
idx = ${test_no}
`;
const result = await db.query(sql).catch(() => {return false});
if (result.length === 0) return false;
return result[0].total_count === result[0].current_count;
} catch {
return false;
}
----------------------------------------
let t = undefined or null
t.length === 0
try {
const sql = `
SELECT
total_count ,
current_count
FROM
content_test
WHERE
idx = ${test_no}
`;
const result = await db.query(sql).catch(() => {return null});
if (result?.length > 0) {
return false;
}else{
return result[0].total_count === result[0].current_count;
}
} catch {
return false;
}