I am having problem connecting to a sqlite database. I can connect to it in standalone environment but I got the error "'Revdberr, Invalid database type" when I tested the app on the simulator. I am using LC 7.1, Commercial version, xCode 6.4. Here is a snippet of the code:
Code: Select all
if the environment is "mobile" then
answer " Mobile Environment is --> " & the environment
put specialFolderPath("engine") & "/MyAppDB.sqlite" into engineFilePath
put specialFolderPath("documents") & "/MyAppDB.sqlite" into tDatabasePath
if there is a file engineFilePath then
if there is a file tDatabasePath then
// do nothing, db already exists in documents folder
answer information " Nothing to do. All is setup ... "
else
put URL ("binfile:" & engineFilePath) into URL("binfile:" & tDatabasePath )
end if
end if
put specialFolderPath("documents") & "/MyAppDB.sqlite" into gMyAppDBPath
else --- not mobile
put "/users/frantzcharles/documents/All About LiveCode/MyApp/MyAppDB.sqlite" \
into gMyAppDBPath
end if
answer " I am here ..."
answer " Path is ... " & gMyAppDBPath
try
put revOpenDatabase("sqlite", gMyAppDBPath ) into g_ConID
put result() into tResult
answer "Open db result is ..." & tResult
catch theError
answer info "Problem Opening database: " & gMyAppDBPath & " - " & theError
put 0 into g_ConID
end try
if g_ConID is not an integer then
answer "DB Connection failure " & g_ConID
else
answer "Connection details are ..." & result() & " - " & gMyAppDBPath & " - " & g_ConID
end if
Fanfan