[英]Node-firebird sequentially select
I am trying to get the data from Firebird DB with sequentially select option.我正在尝试使用顺序选择选项从 Firebird DB 获取数据。 I would like to get the first 500 rows, as you see on my code.
正如您在我的代码中看到的那样,我想获得前 500 行。 And for testing, I am increasing 'k' for each 'row' and logging 'k' and 'md5' to the console.
对于测试,我为每个“行”增加“k”,并将“k”和“md5”记录到控制台。
When I am running my code, it gives me random number of rows.当我运行我的代码时,它给了我随机的行数。 But the number of rows are always more than 500.
但是行数总是超过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();
});
});
Please check the link above:请检查上面的链接:
https://github.com/hgourvest/node-firebird/issues/78 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.
@sdnetwork sdnetwork 一小时前评论说这是 node-firebird 中的一个错误,我有一个解决这个问题的方法。 i will post it soon here.
我很快就会在这里发布。 (try with that https://github.com/sdnetwork/node-firebird )
(尝试使用https://github.com/sdnetwork/node-firebird )
根据 firebird 的版本,“select first n”可能会出错,除非您还包含“order by”子句
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.