revOpenDatabase SQLite on IOS device and simulator

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TonyC
Posts: 2
Joined: Sun Apr 26, 2015 1:37 am

revOpenDatabase SQLite on IOS device and simulator

Post by TonyC » Sun Apr 26, 2015 1:54 am

I am developing an app for IOS and eventually Android using a SQLite Database. It all works fine with the IDE on my mac, but when I test the app on the simulator and the device, it simply closes down without catching the error. This happens frequently, that is, opens and runs then not for another 2-3 or more attempts then opens and runs. The code snippets are as follows:

Code: Select all

 
  if the platform is "iphone" then
      put specialFolderPath("engine") & "/playtime.sqlite" into engineFilePath
      put specialFolderPath("documents") & "/playtime.sqlite" into tDatabasePath
      if there is a file engineFilePath then
         if there is a file tDatabasePath then
            // do nothing, database already exists in documents folder
            answer information "Nothing to do, all setup"
         else
            put URL ("binfile:" & engineFilePath) into URL ("binfile:" & tDatabasePath)
            answer information "Copy DB Structure " & the platform
         end if
      end if 
   end if
   // connect to DB
   answer "connecting to DB"
   databaseConnect
   answer information "DB Connect " & the platform
...
...
command databaseConnect
   ## The database must be in a writeable location
   if the platform is "iphone" then
      put specialFolderPath("documents") & "/playtime.sqlite" into gPlaytimeDBPath
   else
      put specialFolderPath("home") & "/Games/PlayTimer/playtime.sqlite" into gPlaytimeDBPath
   end if
   answer "Path is " & gPlaytimeDBPath
   ## Open a connection to the database
   ## If the database does not already exist it will be created
   try
      put revOpenDatabase("sqlite", gPlaytimeDBPath) into gPlaytimeDBID
      put result() into tResult
      answer "open db result is " & tResult
   catch theError
      answer info "Problem Opening Database: " & gPlaytimeDBPath & " " & theError
      put 0 into gPlaytimeDBID
      exit databaseConnect
   end try
   if gPlaytimeDBID is not an integer then
      asnwer "DB Connection failure " & gPlaytimeDBID
   else
      answer "Connection details are " & result() & " - " & gPlaytimeDBPath & ", " & gPlaytimeDBID
   end if
   //put gPlaytimeDBPath & ", " & gPlaytimeDBID into field "Status"
   //put result() & return before field "Status"
end databaseConnect
The app seems to be crashing at the put revOpenDatabase("sqlite", gPlaytimeDBPath) into gPlaytimeDBID line of code. I am receiving the IOS messages upto displaying the "Path" (answer "Path is " & gPlaytimeDBPath) but nothing after the "revOpenDatabase" command.

I am using LiveCode 7.0.4 Build 10030 and xCode Version 6.3 (6D570) and IOS 8.2. The app is being testing for iPhone and iPad.

I am almost at the stage of writing my own file handling using the LiveCode file open, read, write and update as I find the app launching issue unreliable for a commercial environment and I certainly do not want to revert to objective C and java coding for the IOS and Android apps.

Is there a setting that I am missing or something else?

Looking forward to resolving this issue so I can move forward with the completion of my app.

Many Thanks,

Tony C.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: revOpenDatabase SQLite on IOS device and simulator

Post by Simon » Sun Apr 26, 2015 2:17 am

Hi Tony,
There is this reported bug;
http://quality.runrev.com/show_bug.cgi?id=15084

Might be what your problem is.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

TonyC
Posts: 2
Joined: Sun Apr 26, 2015 1:37 am

Re: revOpenDatabase SQLite on IOS device and simulator

Post by TonyC » Sun Apr 26, 2015 10:58 am

Hi Simon,

Yes, that looks like what the problem is.

Thanks for the response. I just hope the fix comes quickly.

Regards,

Tony C

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: revOpenDatabase SQLite on IOS device and simulator

Post by quailcreek » Mon Apr 27, 2015 7:42 pm

Tony,
Have you tried this on 6.7.4?
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Databases”