> I wrote this code below, but it seems it's not working properly. It calls
> only addA() and gives me error in tds.js (140) - if (this._currentStatement)
> throw new Error('Statement currently running'):
You have the solution right before your eyes: Wait, until the
statement in addA() is done. Then continue with the next statement.
Quick example:
function addA (a, cb)
{
var stmtA = conn.createStatement('INSERT INTO A (id) VALUES (' + a + ')');
stmtA.on('done', cb || function(){});
stmtA.execute();
}
addA(a, function(){
... next stuff ...
});
BTW: Using the caolans async utitlities helped me a lot in getting the
async-thinking into my head.
https://github.com/caolan/async
--
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