Page 1 of 1

SQL Yoga error on mobile platform

Posted: Sat Aug 30, 2014 10:03 pm
by dsimpson
I am trying to use SQL Yoga to connect to an embedded SQLite database with a mobile application, running in the IOS simulator. The stack works fine on the desktop.
It seems like I have the pathname correctly defined, as shown in the PUT statement echoing the pathname I am using to the console.
I get the following error which I don't know how to interpret:

Aug 30 13:33:48 dcsi-MBP15r2.local Application46[70433] <Warning>: [tEnvironment: ]mobile
Aug 30 13:33:48 dcsi-MBP15r2.local Application46[70433] <Warning>: [tDatabaseFile: ]/Users/dsimpson/Library/Application Support/iPhone Simulator/7.1-64/Applications/BB5EA7A3-9545-42A9-931B-0967CB7A77C3/Documents/SQLiteDB.db3
Aug 30 13:33:48 dcsi-MBP15r2.local Application46[70433] <Warning>: 219,4500,17,revOpenDatabase
465,4500,1
587,4411,1
253,4385,1
241,4385,1,dbconn_connect
353,0,0,stack "libSQLYoga" of stack "/Users/dsimpson/Library/Application Support/iPhone Simulator/7.1-64/Applications/BB5EA7A3-9545-42A9-931B-0967CB7A77C3/Application46.app/Application46"
573,161,1,dbconn_connect

The LiveCode Error Lookup Stack shows:
219 Function: error in function handler
465 put: error in expression
587 switch: error in statement
253 if-then: error in statement
241 Handler: error in statement
353 Object Name:
573 Handler: can't find handler

The portion of the code making the connection looks like this:

Code: Select all

        
case "mobile"
               -- copy SQLite file to documents path to allow Read/Write access
               put specialFolderPath("documents") & "/" & tDBName into tDatabaseFile
               put "[tDatabaseFile: ]" & tDatabaseFile
               if there is not a file tDatabaseFile then
                  put specialFolderPath("engine") & "/" & tDBName into tEngineFilePath
                  put URL ("binfile:" & tEngineFilePath) into URL ("binfile:" & tDatabaseFile)
               end if
               break
 ## Tell the Connection object where the database file is
         put "[tDatabaseFile: ]" & tDatabaseFile
         dbconn_set "file", tDatabaseFile

Re: SQL Yoga error on mobile platform

Posted: Sat Aug 30, 2014 10:14 pm
by dsimpson
Never mind...

A few minutes after I posted this message, I noticed that I had forgotten to add SQLite to the standalone settings for IOS.
So I guess we now know what that type of error message looks like. You need to do this on both IOS and Android if SQLite or MySQL is going to be used by the app.

Re: SQL Yoga error on mobile platform

Posted: Sun Aug 31, 2014 12:03 am
by trevordevore
I was just going to suggest that something was different on mobile vs. desktop because revOpenDatabse was failing. I'm glad you already found the solution :-)