Forum BigDB Idiom for accessing several databases?

Discussion and help relating to the PlayerIO database solution, BigDB.

Idiom for accessing several databases?

Postby johnnyk427 » April 26th, 2012, 12:20 am

This is more of a best-practices question. I'm loading and saving from/to several different tables, what's the best way to not call the given callback until all operations have succeeded?

Right now i'm chaining each successive database acccess off the success callback of the last one, but it would be nice to do them all in parallel, if there was an easy way to track when they were all finished. Just need a creative use of ActionScript, I think!
johnnyk427
Paid Member
 
Posts: 9
Joined: March 31st, 2012, 2:05 am

Re: Idiom for accessing several databases?

Postby Benjaminsen » May 1st, 2012, 12:29 pm

I personally use a local variable and function to handle parallelized Player.IO calls.

IE
Code: Select all
function(){
   needscallback1(allready)
   needscallback2(allready)
   needscallback3(allready)
   var toexecute:int = 0
   function allready(){
      if(++toexecute==3){
         //The code that needs to run when parallel execution is done goes here
      
      }
   }
}
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Idiom for accessing several databases?

Postby johnnyk427 » May 1st, 2012, 7:13 pm

Nice, I spotted that method in the samples actually and have been following that as well recently.
johnnyk427
Paid Member
 
Posts: 9
Joined: March 31st, 2012, 2:05 am


Return to BigDB