Android Question sql delete question

crimson ghost

Member
Licensed User
I have been trying out SQLite and ran into something odd. I have just implemented a Delete function and it appears to work fine. It no longer shows up in specific queries or if I list all records in the appropriate table. However, if I take the database file to a PC and examine it, the rows are still there and they show up in the same queries that, on my emulator, they do not. Android no longer sees them even though windows shows they are still there. It doesn't really matter I suppose since this is an Android app and they shouldn't show up but what happens if I create a new record identical to one that I deleted? I assume it will show upon Android but, when I look at it on a PC, will I now have two identical records? My
 

drgottjr

Well-Known Member
Licensed User
first, identical records can exist. if you don't want that, you need to set the db up that way. there are a couple ways to do that. second, your description of what happened prompts a lot of questions. third, i move databases back and forth from pc to emulator to device without issue.

it would be interesting to know exactly what you do after deleting records and exactly how you "take the database file to a PC". where is your emulator?
a small code snippet and a detailed description of the "taking" of the database file would help greatly. i already suspect a few scenarios where things could go wrong. show us what you do.
 
Upvote 0

aeric

Expert
Licensed User
I suspect there are 2 database files in your phone. If you add the db file into DirAssets folder, this database will not be modified. The database you copy to another storage will be modified.

If you add a default database to your project in the files Tab, it is located in the DirAssets
folder. Databases cannot be accessed in DirAssets even if it's only for reading.

Therefore, you must copy it to another folder.
Example in the SQLiteLight1 programs.
 
Upvote 0
Top