خرید بک لینک

Vote count: 0

I read other questions but none of them seemed to focus my specific problem. I am using the following code to coect to a database, within other callbacks for other things. Here is an extract of my code:

addNew(arg){

    checkDatabase(ar,function(rows){

        //inside callback

        var info = rows[0];

        if(info.something == somesome){
            SQLInsertArg(arg,function (){
                //Yet another callback
            });
        }else{

        }

});

Obviously my programming logic depends on code within code and callbacks within callbacks. But what I'd like is to be able to access the database and retu values on the "addNew" function after allcallbacks have been performed. This loosen processing structure happens because my function that coects to mysql is done via function(query, callback) from the npm package mysql. There so, what I'd like to know is how to retu values from the addNew function so I can properly and easily setup an appropriate logic flow.

asked 27 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 16 تير 1395 ساعت: 21:58

صفحه بندی