3 Replies Latest reply on Oct 22, 2013 2:46 AM by Armen Malxasyan

    Custom Database File Problems

    Armen Malxasyan

      I am trying to load a custom sqlite file

       

      db = Rho::Database.new(Rho::Application.databaseFilePath(Rho::RhoFile.join("public", "mbtiles.sqlite")),"mtiles")

       

      it's in /public folder  .

       

      I am getting

       

       

      Server Error

      Error: could not prepare statement: 21; Message: unable to open database file
      Trace:
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:174:in `execute'
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:174:in `_execute_sql'
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:133:in `executeSql'
      C:/Users/gabgub/workspace/Radio/app/Settings/controller.rb:16:in `index'
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rhocontroller.rb:101:in `serve'
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rhoapplication.rb:217:in `serve'
      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:895:in `serve'

       

       

       

      What I am doing wrong?

        • Re: Custom Database File Problems
          Kutir Mobility

          Hi Armen,

          Try as shown below,

              db = Rho::Database.new(Rho::RhoFile.join(Rho::Application.publicFolder, "mbtiles"),"mbtiles")

          Remove "Rho::Application.databaseFilePath". It is a path to default database file.

          Use "Rho::Application.publicFolder", if you want to use /public folder for a custom database.

           

          Visnupriya R

          Kutir Mobility

          1 of 1 people found this helpful
            • Re: Custom Database File Problems
              Armen Malxasyan

              Now seems it could open the file. But it can't see the table.

               

              Error: could not prepare statement: 1; Message: no such table: tiles

              Trace:

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:174:in `execute'

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:174:in `_execute_sql'

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/commonAPI/coreapi/RhoDatabaseApi.rb:133:in `executeSql'

              C:/Users/gabgub/workspace/Radio/app/Settings/controller.rb:16:in `index'

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rhocontroller.rb:101:in `serve'

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rhoapplication.rb:217:in `serve'

              C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:895:in `serve'



              What you think?

            • Re: Custom Database File Problems
              Armen Malxasyan

              Solution is

               

               

                db = Rho::Database.new(Rho::RhoFile.join(Rho::Application.publicFolder, "mbtiles.sqlite"),"mbtiles")

               

               

              Only problem stays how to send custom header and  image itself ...