4 Replies Latest reply on Aug 11, 2011 4:56 PM by Francisc

    Mobile App Best Practice When Using SQLite Database

    Francisc Level 3

      Hello,

       

      I have a mobile app that has several views.

      Each view calls a different method of a Database custom class that basically returns the array from a synchronous execute call.

       

      So, each view has a creationComplete handler in which I have something like this:

       

      var db:Database=new Database();
      var connectResponse:Object=db.connect('path-to-database');
      if(connectResponse.allOK)//allOK is true if connection was succesful
      {

         //Do stuff with data

      }

      else

      {

         //Present error notice

      }

       

      However this seems reduntant. Is it OK to do this once (connect the the database) in the Main Application file?

      The do something like FlexGlobals.topLevelApplication.db?

       

      And even generally speaking, constants and other things that I would need throughout the app, can be placed in the main app? As a best practice, not technically as technically it is possible.

       

      Thank you.