SQLite: Error 8

I had a crazy idea minutes ago, that leads into a error:

Run an application that deals with a SQLite Database (db).
Fill the Window Controls,
Remove the file,
Click in the Insert Button to insert a brand new Record in the db file.

The error I got was:

Error 8: attempt to write a readonly database

Nota: the data base was not read only (nor Locked, and there is a specific error code/message for it), but I simply trashed it.

What were you expecting to happen - you deleted the file…?

On a Mac, that may have actually moved it to the Trash and it probably is read only there.
Try that again in debug mode and before you try to write, check what the path to the file is in the debugger.

If you think your users would be daft enough to do this in a real life situation, then DONT keep a live connection to the database.

[quote]Check the file exists , try to connect,get the data
Populate the window, disconnect.
Amend the window
Save
Check the file exists , try to connect, then write.[/quote]

Thanks for your answer Jeff.

I do not recall why I’ve done that (halp trashing the file). It is possible that files/folders in the Trash become Read only. Makes sense.
No, I simply moved it to the Trash.

Mac: because I already had a file with this name in the Trash, the one I refer to get a name change (but the FolderItem still link to it…)

Thank you for the advice.

PS: I will test the same, but after deleting the db file. Just to know what error message I will get. :wink: