我正在使用mysql
node.js。
NULL
此查询通过检查是否至少有一行不是 来检查列是否具有所有值NULL
。
SELECT 1 FROM `table` WHERE `column` IS NOT NULL LIMIT 1
如果该列具有所有NULL
值,则此查询会在几秒钟(〜120)后在 SQL 进程列表中结束,但我从未从 js 代码中得到回调:
import {createPool as mysqlCreatePool, MysqlError} from 'mysql';
const db = mysqlCreatePool({...})
const query = db.query(sql, undefined, function (err: MysqlError | null, res?: any) {
console.log(err, res);
});
query.on('end', () => console.log("end"));
(控制台中没有打印任何内容)