Im porting an iOS app I wrote at the moment that uses sqlite.
In the app I use the following commands...
In the preopen stack I use the following to get the path to the documents
put specialFolderPath("documents") into gPathToDocuments
When its time to open the database I call...
put gPathToDocuments & "progress.db" into dbPath
put revOpenDatabase ("sqlite",dbPath,,,,) into gProgressDBID
On iOS this works fine, if the file isnt found it is created, however on android the 2nd line here causes my App to stop, ie. anything after this line is not processed.
The dbPath always seems to be returned as '/progress.db' which seems wrong to me.
Whats the best way to get this working on android???
Thanks
Andy
SQLite & Android
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: SQLite & Android
Hi Andy,
looks like you forgot to add a SLASH after the specialfolderpath!?
...
put specialFolderPath("documents") & "/" into gPathToDocuments
...
Best
Klaus
looks like you forgot to add a SLASH after the specialfolderpath!?
...
put specialFolderPath("documents") & "/" into gPathToDocuments
...
Best
Klaus
Re: SQLite & Android
Thanks Klaus,
Tried that but no change im afraid.
Its like the database location is not writeable? Is it possible to create a database on Android or can you only work with ones that are already there?
Tried that but no change im afraid.
Its like the database location is not writeable? Is it possible to create a database on Android or can you only work with ones that are already there?
Re: SQLite & Android
Just to update this, the specific error returned after the db command is...
Database Error: Unable to open the database file.
This isnt surprising as there is no db file initially, on all other deployments including iOS the engine creates a database if one is not found, but it looks like this isnt happening which is why I was questioning the path, is '/' correct as this is what is being returned by specialfolderpath("documents")
Database Error: Unable to open the database file.
This isnt surprising as there is no db file initially, on all other deployments including iOS the engine creates a database if one is not found, but it looks like this isnt happening which is why I was questioning the path, is '/' correct as this is what is being returned by specialfolderpath("documents")
Re: SQLite & Android
No idea why, but its just started working!
All I did was uncheck the Android build and did a test build in iOS, then went back and re-enabled the Android build in the standalone settings area and now it works too.
All I did was uncheck the Android build and did a test build in iOS, then went back and re-enabled the Android build in the standalone settings area and now it works too.
Re: SQLite & Android
Hi Andy,
glad you got it working.
Since I do not develop for Android, I can only be of general help.
And since ALL specialfolderpath(xyz) come with NO slash at the end, I'm sure this should be also the case on Android!
If there really IS A SLASH at the end on Android with specialfolderpath("documents") I consider this as a BUG for "conceptional continuity" sake
Best
Klaus
glad you got it working.
Since I do not develop for Android, I can only be of general help.
And since ALL specialfolderpath(xyz) come with NO slash at the end, I'm sure this should be also the case on Android!
If there really IS A SLASH at the end on Android with specialfolderpath("documents") I consider this as a BUG for "conceptional continuity" sake
Best
Klaus