Node-firebird 依次 select

Node-firebird sequentially select

我正在尝试使用顺序 select 选项从 Firebird DB 获取数据。正如您在我的代码中看到的那样,我想获得前 500 行。为了测试,我为每个 'row' 增加 'k' 并记录 'k' 和 'md5' 到控制台。

当我 运行 我的代码时,它会给我随机的行数。但是行数总是超过500。

我该如何解决这个问题?有什么建议么?

var Firebird = require('node-firebird');
var md5 = require('md5');
var options = {};
//options.host = '127.0.0.1';
//options.port = 3050;
options.database = '/Users/bla/mydb.FDB';
options.user = 'SYSDBA';
options.password = 'masterkey';
var pool = Firebird.pool(10, options);
var k = 0;
pool.get(function (err, db) {

  if (err)
    throw err;
  db.sequentially('SELECT FIRST 500 SOME QUERY', function (row, index) {
    k = k + 1;
    console.log(k + ' => ' + md5(JSON.stringify(row)) + '\n');
  }, function (err) {
    db.detach();
  });
});

请检查上面的link:

https://github.com/hgourvest/node-firebird/issues/78

@sdnetwork sdnetwork commented an hour ago it's a bug in node-firebird, i have a fix for this problem. i will post it soon here. (try with that https://github.com/sdnetwork/node-firebird)

根据 firebird 的版本,"select first n" 可能会报错,除非你还包含一个 "order by" 子句