我得到
error: Unhandled Rejection at: Promise {"_bitField":18087936,"_fulfillmentHandler0":{}}
在
var Query = [
`SELECT COUNT(*) FROM ${table1};`,
`SELECT COUNT(*) FROM ${table2};`
];
sequelize.query(Query).then(result => {
console.log(result);
});
什么原因导致此错误?
答案 0 :(得分:0)
在处理承诺时始终使用catch块。
`sequelize.query(Query).then(result => {
console.log(result);
}).catch(error => console.log(error));`
答案 1 :(得分:0)
在创建连接时必须设置multipleStatements = true:
new Sequelize(..., {
dialectOptions: {
multipleStatements: true
}
})