Blob, Sequentially API changes and some bugs
BLOB
I have done some works on our provider this week. Initially it was to find a good solution about the blob problem ( #51 #82)
In fact the problem is that a transaction is open each time we read a blob but it's not a good solution (http://tracker.firebirdsql.org/browse/CORE-2086).
so the tip is to use the same transaction to fetch the rows and read the blob, but in the current api we get the rows in the callback after the transaction is finished ! So we need to change some behaviour !
In the api we can separate two kind of method by database object or by transaction object. the solution is to fetch automatically the blob when we use the database object. no change with the transaction.
SEQUENTIALLY
An other thing about the sequentially API, today we can't use it with an other asynchronous api. So i have had a third parameter to the callback like the async library
db.sequentially(query, [params], function(row, index, next) {
res.write(JSON.stringify(row) + ',');
next()
}, function(err) {
res.end(']');
});
i have also add a new method in transaction object => transaction.sequentilally
BUGS
When i have done the change in the provider i have found some problems
- in the decoderesponse in fact we can get a false callback if there are several gds error in same time because the lookupMessages is async.
- A problem with the pool when there are error on socket.
i have planned to push the changes on my repository https://github.com/sdnetwork/node-firebird, for people want to try the new things and after that i could do a pull request.
ps : these changes can break some code, but the convertion is really easy
- if you play with blob with database object, you get directly the blob no need to call the function.
- if you use the sequentially api don't forget to call the next method in each row
all comments are welcome
It's done, you can check on https://github.com/sdnetwork/node-firebird
Yes, @sdnetwork your version all works fine.
There is a possibility to your code be submited to npm?
@tfiliano , i have done a publish on [email protected]
How, can I set callback after all records are readed?
@hgourvest could we get the Blob solution from @sdnetwork implemented? Tried to read blobs from Firebird 3.0 which I could not get to work with the current version. See also #241.
hi @hgourvest and @sdnetwork is there any way to help bring both version together? it seems there are interesting changes in both versions?
@sdnetwork could you create a pr for the transaction/sequentially changes? @hgourvest would you be willing to merge a good pr? how could someone else (like me) help to accomplish this?
thanks sebastian
Please I want to kwon too...
https://github.com/hgourvest/node-firebird/issues/273
would be awesome
hi @hgourvest and @sdnetwork i would be willing to pay 500€ bounty to get a version that has async compatible sequentially functionality. can i motivate someone to pull up his sleeves? ;-)
@dotob you can donate for me if you can , i will try to merge it and maybe rewrite the pull request when i have time
https://github.com/sponsors/mariuz