xdenser/node-firebird-libfbclient — Issue #8: addFBevent doesn't work if event name is not "fbevent"
Author: ozalexo
Created: 2012-03-05 01:32:49+00:00
State: open

If 'eventName' variable in the source code below will be changed from "fbevent" to "otherNamedFbevent" (or any other) than application would not receive any notifications from Firebird DB (case-insensitive issue). So, I can subscribe only to "fbevent" named event. At the same time FlameRobin's Event Monitor receiving all events correctly. FB version = 2.5. Node.JS version >= 4.

Test code:

var fb = require('firebird');

var i = 0;
var eventName = "otherNamedFbevent";

var conn = fb.createConnection();
conn.connectSync('nodejs:/opt/firebird/dbs/testdb.fdb', 'SYSDBA', 'masterkey', '');
conn.addFBevent(eventName);
conn.on(eventName, function(event,count){
console.log('GOT EVENT ' + (++i));
});

WaitForFinish(function(){ return finished; },
function(){
conn.disconnect();
}, 200000);

var finished = false;

function WaitForFinish(finished,clean,timeout){
var timedout = false;
var tid = setTimeout(function(){
timedout = true;
},timeout);
process.nextTick(function loop(){
if(finished.call()||timedout){
clearTimeout(tid);
clean.call();
}
else process.nextTick(loop);
});
}