Node-firebird sequentially select

霸气de小男生 提交于 2019-12-12 10:52:44

问题


I am trying to get the data from Firebird DB with sequentially select option. I would like to get the first 500 rows, as you see on my code. And for testing, I am increasing 'k' for each 'row' and logging 'k' and 'md5' to the console.

When I am running my code, it gives me random number of rows. But the number of rows are always more than 500.

How can I solve this problem? Any suggestions?

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();
  });
});

回答1:


Please check the link above:

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)




回答2:


depending upon the version of firebird, "select first n" may give an error unless you also include an "order by" clause



来源:https://stackoverflow.com/questions/32911645/node-firebird-sequentially-select

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!