sequentially
db.sequentially()方法为序列化查询,其语法格式如下,其中参数可省:
db.sequentially(query, [params], function(row, index), function(err))
如下实例代码:
db.sequentially('SELECT * FROM a', function(row, index) {
// EXAMPLE
console.log(row) ;
}, function(err) {
if (err)
throw err;
// END
// IMPORTANT: close the connection
db.detach();
});
打印的结果为:
{ ID: 1, NAME: 'tom' }
{ ID: 2, NAME: 'jim' }
练一练sequentially方法吧!