asfernandes / node-firebird-drivers

Node.js Firebird Drivers
MIT License
53 stars 17 forks source link

Support for Firebird events #34

Closed asfernandes closed 4 years ago

iyudincev commented 4 years ago

A test script crashes randomly with the following output:

undefined:0

[Error: Invalid argument]

"node-firebird-driver-native": "^1.1.0-beta.1". Tested with Firebird 3.0.5 on Ubuntu 18.10, the script runs on Node.js 13.1.0 + Windows 7 and 12.13.0 + Ubuntu 18.10.

The test script code follows ``` const { createNativeClient, getDefaultLibraryFilename } = require('node-firebird-driver-native'); async function test() { const client = createNativeClient(getDefaultLibraryFilename()); const attachment = await client.connect('192.168.65.136:/var/lib/firebird/3.0/data/data.fdb', { username: 'SYSDBA', password: '1' }); const events = await attachment.queueEvents([ 'data_insert', ], (counters) => { console.log(counters); }); console.log('Waiting...'); await new Promise(resolve => { setTimeout(resolve, 30000); }); await events.cancel(); await client.dispose(); } test().then(() => console.log('Finish...'), (err) => console.error('Finished with error: ', err)); ```

asfernandes commented 4 years ago

Is the event being posted somewhere or not?

iyudincev commented 4 years ago

Yes, I run a script in IB Expert, like EXECUTE BLOCK AS BEGIN POST_EVENT 'data_insert' END; COMMIT; a few times.

asfernandes commented 4 years ago

@iyudincev a have committed a fix. Can you test it (master branch) before a npm release?

iyudincev commented 4 years ago

It seems to work fine now, the script does not crash.