Node-firebird依次选择 [英] Node-firebird sequentially select

查看:110
本文介绍了Node-firebird依次选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过顺序选择选项从Firebird DB获取数据。我想在我的代码中看到前500行。为了测试,我为每个'row'增加'k'并将'k'和
'md5'记录到控制台。

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.

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

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


推荐答案

请检查以上链接:

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


@sdnetwork sdnetwork一小时前评论说它是node-firebird中的一个bug,我有一个解决这个问题。我很快就会在这里发布。 (尝试使用 https://github.com/sdnetwork/node-firebird

这篇关于Node-firebird依次选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆