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