Ydm Active Member Licensed User Longtime User Dec 17, 2016 #1 I am opening Sqlite to memory. Code: Copy SQL1.Initialize("", ":memory:", True) Then I add the DB. Code: Copy SQL1.ExecNonQuery("attach database '"&Starter.rp.GetSafeDirDefaultExternal("")&"/data.db'"&" as data") I am deleting the physical db file for security. I can not use SQL later. How can I solve this problem? I need to delete the physical file after initialization.
I am opening Sqlite to memory. Code: Copy SQL1.Initialize("", ":memory:", True) Then I add the DB. Code: Copy SQL1.ExecNonQuery("attach database '"&Starter.rp.GetSafeDirDefaultExternal("")&"/data.db'"&" as data") I am deleting the physical db file for security. I can not use SQL later. How can I solve this problem? I need to delete the physical file after initialization.
M Mahares Expert Licensed User Longtime User Dec 17, 2016 #2 If I understand you correctly; You want to delete data.db via a file manager or other means. Don't you have to detach it first? Code: Copy SQL1.ExecNonQuery("DETACH DATABASE data") 'Detach the physical database Please forgive me if I did not understand your question. Upvote 0
If I understand you correctly; You want to delete data.db via a file manager or other means. Don't you have to detach it first? Code: Copy SQL1.ExecNonQuery("DETACH DATABASE data") 'Detach the physical database Please forgive me if I did not understand your question.
Ydm Active Member Licensed User Longtime User Dec 17, 2016 #3 Sorry. My English is not good. I'm using google translate. My problem is not to delete it. (File.Delete(Starter.rp.GetSafeDirDefaultExternal(""),"data.db")) I'm deleting my physical database. I do not delete the memory. But after this deletion the query does not work. It gives a disk error. Error: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 1802) Last edited: Dec 17, 2016 Upvote 0
Sorry. My English is not good. I'm using google translate. My problem is not to delete it. (File.Delete(Starter.rp.GetSafeDirDefaultExternal(""),"data.db")) I'm deleting my physical database. I do not delete the memory. But after this deletion the query does not work. It gives a disk error. Error: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 1802)
Erel B4X founder Staff member Licensed User Longtime User Dec 18, 2016 #4 attach database doesn't copy the database. You need to create new tables in the memory database and copy the tables from the attached database. Only then you can delete it. Upvote 0
attach database doesn't copy the database. You need to create new tables in the memory database and copy the tables from the attached database. Only then you can delete it.