2012/6/1 Henri Gourvest <[email protected]>
> Le 01/06/12 16:23, Denys Khanzhiyev a écrit :
>
>> Thanks. A bit tricky.
>>
> how would you do it more simply ?
> everything is async!
It is not obvious what and where is going on. Here is my proposal, while it
is a bit tricky too :-)
Have not tested if it works actually
function() {
var tr, st;
function error(err) {
if (tr) tr.rollback();
if (st) st.drop();
console.log(err);
}
function fetchByOne(onData,onEnd,error)
{
database.startTransaction(function(transaction) {
tr = transaction;
tr.newStatement("select * from rdb$relations", function(statement) {
st = statement;
st.execute(tr, function() {
(function cb(fetched) {
if (fetched) {
st.drop();
tr.commit(); // fetch finished
onEnd();
} else {
st.fetch(tr, function(ret) {
onData(ret.data); // fetch is going on
cb(ret.fetched);
}, error)
}
})(false);
}, error)
}, error);
}, error)
}
fetchByOne(function(data){
console.log(data);
},
function(){
console.log(finished);
},error);
>
>
> And how not to fetch blobs? Blobs are better to
>
>> stream.
>>
>
> if you do not give a transaction to the fetch method, blobs are not
> fetched.
>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-**
> Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> nodejs+unsubscribe@**googlegroups.com<nodejs%[email protected]>
> For more options, visit this group at
> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en