How can I check a SQLite DB While Debugging

Hi,

When I do any kind of Database work I always look at the tables Using Navicat to determine if the correct values are being written to the DB.

I have connected with the path Xojo/iOS/Tables/TablesMobile.debug.app/data/ASPEdata.sqlite and testing connection comes back OK.

I’m doing an update and not getting any error, yet when I look at the table no update appears to have been done.

Also is there a way to make any data written to a SQLite db persistent between debugging sessions?

If you’re talking about the data written/saved by your app running in the iOS Simulator, the locations are not within any of the Xojo folders. In Xcode 6 / iOS 8 you’ll find them in:

Library/Developer/CoreSimulator/Devices/{GUID}/Data/Containers/Data/Application/{GUID}

I just view these folders in the Finder and sort by Date Modified. Then, as I change data within my app, the folders become obvious.

I’m not using iOS, but on Windows Desktop, I have to refresh the view in Navicat to see the updated information. Also, another time I had an issue with this, I had a transaction that was left open that I thought was closed.

I tried looking at the SQLite in the app package but my app wasn’t updating the table, but got no error message?

Did you mean you are attempting to write to an SQLite database that is in your applications RESOURCES (i.e., you dragged/copied it into the app?)
If so, then you must not be doing any error checking, otherwise you would have seen that the database would be READONLY, as you are not allowed to write to the “bundle” (same with iOS where you cannot write to /RESOURCES), The database MUST be copied or created in an appropriate location

and if not using IOS then why does the path you mentioned indicate otherwise?
Or did you mean you were creating an XOJO iOS application, but running it in the Simulator? in which case the data Jason provided is the correct info.

I meant in the Simulator.

I have found the file using the path: Library/Developer/CoreSimulator/Devices/{GUID}/Data/Containers/Data/Application/{GUID}

and confirmed it is writing to it successfully.

Now here’s the next question. I need to test the app with some persistent data. Do I need to modify the tables before I launch the app? Is there a way to have data persistent between debugging sessions?

the GUID should remain consistent unless
a) you delete it
b) you tell the iOS simulator to change device types (in which case the data stays for the device you WERE using, and is NEW for the next device)…

I am doing something similar right now with an SQLite Database in SWIFT, and it stays from session to session

The Guid for the device doesn’t change, but the guid for the app changes.

Then XOJO must be doing something.
I have run my SWIFT app hundreds of times in iOS Simulator, and the SQLite database has remained intact, except when I decided to delete it and start over.

It changes the last Guid:

Library/Developer/CoreSimulator/Devices/{GUID}/Data/Containers/Data/Application/{GUID}

So it creates a new container everytime you run it??? that would be a pain

I just checked mine… after a full days work… there are TWO GUID added today…
One for an iPad2 and one for an iPad Retina (this is an iPad only app, and I chose the retina simulator by mistake … its too big to show on screen)

[quote=213590:@Dave S]So it creates a new container everytime you run it??? that would be a pain

I just checked mine… after a full days work… there are TWO GUID added today…
One for an iPad2 and one for an iPad Retina (this is an iPad only app, and I chose the retina simulator by mistake … its too big to show on screen)[/quote]

Xojo is the same. It doesn’t create new GUIDs every time you run the app in the Simulator.

which is how it should be… then the only thing I can thing of as a cause to the OP issue, is that the app is over-writing/recreateing the database each time?

Actually I just re-checked and the application GUID is changing every time the app runs, but the device GUID remains the same. I don’t think it used to do this but it may just be that I didn’t notice before because I always sort by Date Modified when viewing my Simulator files so the folders don’t appear to move around.

But in any case, the saved data is preserved even though the application GUID changes so this doesn’t affect debugging.

I don’t get it. I can write a change to the db in the app, watch the db and verify that the change was made. Close the app and relaunch it and the app is no longer looking at the same app guid, the same device but not the same app. I’m using just the ip6. So I’m not sure how you app is saving data between debug sessions???

I’m using XCODE, and the GUID only changes if I tell the simulator to use another device (or if I test another application)
So basically the DEVICE/APP combo seems to equate to a GUID directory which in turn is the /DOCUMENT directory for that app.

So if I run app XYZ simulating an iPhone6+ it always goes to the same place, therefore I always get the same data

Were talking Xojo, Xcode has no bearing.

well yes it does… because the simulator is involved… if XOJO changes the app GUID every run, then it is doing something wrong. I was using XCODE as the example of what it should do.

Another reason, that iOS XOJO is not even close to being ready for prime-time

@Paul Lefebvre , @Norman Palardy

Would this be considered a bug?

According to this StackOverflow post, this is expected behaviour: Xcode 6 keeps renaming my app’s directory in iOS8 simulator after each run.