This commit is contained in:
aozhiwei 2023-07-05 17:43:02 +08:00
parent 46bf5c4dd5
commit 22eef8b27c

18
db.js
View File

@ -222,6 +222,24 @@ class DB {
};
}
async getMaxIdx(tblName) {
const params = [];
let sql = 'SELECT max(idx) AS max_idx FROM `' + tblName + '` ';
const {err, row} = await this.execQueryOne(sql, params);
if (err) {
return {
'err': err,
'maxIdx': BigInt(0)
};
} else {
return {
'err': err,
'maxIdx': row && row['max_idx'] != null ? BigInt(row['max_idx']) : BigInt(0)
};
}
}
}
module.exports = DB;