Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node-firebird sequentially select

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();
  });
});
like image 536
Tural Gulmammadov Avatar asked Oct 02 '15 16:10

Tural Gulmammadov


1 Answers

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)

like image 176
Tural Gulmammadov Avatar answered Oct 22 '22 05:10

Tural Gulmammadov