Node-firebird sequentially selects

I am trying to get data from a Firebird database with a sequential selection. I would like to get the first 500 lines, as you see in my code. And for testing, I increment "k" for each "line" and write "k" and 'md5' to the console.

When I run my code, it gives me a random number of lines. But the number of lines is always greater 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(); }); }); 
+5
source share
2 answers

Please check the link above:

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

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

+1
source

depending on the version of firebird, "select first n" may give an error if you also did not include the "order by" clause

0
source

Source: https://habr.com/ru/post/1232817/


All Articles