3 Replies Latest reply on Dec 28, 2012 4:49 AM by Pierre Lotin

    Find application models data via PC

    Pierre Lotin

      Hello to all!

       

      I would like to know how to recover data from my application when I plug my ET1 to my PC. I just want to recover, I suppose, a SQLite file or something like that. I tried to analyze what I could find, including a file "file__0/0000000000000001.db" but I can't find my models data. I find instead data of a demo I think (sessionAttendees & eventSessions), weird.

       

      My data seems to be persistent because I kill the application and retrieve my data updated in the application.

       

      Thank you in advance.

        • Re: Find application models data via PC
          Pierre Lotin

          what I search is in data/data/myapp/rhodata which is not accessible, am I wright?

           

          Alternatively, is there a way to tell to the application to move the database where I will find all my data from my different models?

           

          Or, from the application, how to copy the database to /mnt/sdcard/ for example?  

            • Re: Find application models data via PC
              Pietro Francesco Maggi

              Hi Pierre,

              You can use the export/import functions of Rhom to have a copy of the database available to transmit to a PC:

              http://docs.rhomobile.com/rhodes/rhom#importing-and-exporting-the-database

               

              Just keep in mind two things:

              1. If you're using Property bags, your data are not saved in as a separate table in SQLite, but the data are inserted in the object_values table.
              2. by default, the available partition you can use to export the data are "local" and "user":

                            archive_file_local = Rhom::Rhom.database_export("local")

                            archive_file_user = Rhom::Rhom.database_export("user")

               

              So, if you want to use on the PC this data directly from the SQLite file, my suggestion is to use a Fixed Schema. But I hope this is only for testing or during development. Using a webservice interface is much more easier to put in place and maintain (but then you're redoing some of the functionality that RhoConnect already implements).

               

              Please check this question as answered if this is the case.

               

              Pietro

              1 of 1 people found this helpful
                • Re: Find application models data via PC
                  Pierre Lotin

                  Thank you Pietro,

                   

                  ATM we don't want to use RhoConnect,

                   

                  I implemented my solution with web services, I am pretty happy with it, however, object creation takes too much time on my mobile (ET1). I wanted to test the import and export to avoid this [to give the mobile database already full]. However, I have a problem, here is my code for export the database:

                   

                    def httppost_callback
                  
                      begin
                        WebView.execute_js("stHappened('START'); ")
                        archive_file_local = Rhom::Rhom.database_export("local")
                        WebView.execute_js("stHappened('EXPORT (" + archive_file_local + ")'); ") 
                        WebView.execute_js("stHappened('END'); ")
                      rescue Exception => e 
                        WebView.execute_js("stHappened('Erreur (" + e + ")'); ")
                      end
                  
                      sleep(2)
                      WebView.navigate('/app')
                  
                    end
                  
                  

                   

                  I got "START" and nothing else, no exception. At this level it's to understand what happens...

                   

                  Second question: can you tell me why I got an error when my web service returns > 725 objects. Everything is fine when it returns <= 725 objects.

                   

                  EDIT

                   

                  I halved the time of "objects creation" using a FixedSchema. The page "index" for these objects is really slow to appear...