06Pierrick06 Member Licensed User Sep 1, 2019 #1 Hi Dears, My application stores users datas in a SQLite database located in File.Dirinternal. (and initially downloaded from Dropbox at login creation) When I upload this DB to Dropbox from this File.Dirinternal, all tables are empty while datas are populated in the application (!) Is there a magical property of File.Dirinternal I missed somewhere ? It's like there is another "shadow" copy of this DB where datas are populated ?! Code to upload is quite simple : Code: Copy Dim filename As String filename="/Users/DIR_" & sf.Trim(sf.Upper(email.Text)) If File.Exists(File.DirInternal,"poidsww.db") Then dbx.upload(File.DirInternal,"poidsww.db",filename,"poidsww.db") End If Thanks ! Last edited: Sep 1, 2019
Hi Dears, My application stores users datas in a SQLite database located in File.Dirinternal. (and initially downloaded from Dropbox at login creation) When I upload this DB to Dropbox from this File.Dirinternal, all tables are empty while datas are populated in the application (!) Is there a magical property of File.Dirinternal I missed somewhere ? It's like there is another "shadow" copy of this DB where datas are populated ?! Code to upload is quite simple : Code: Copy Dim filename As String filename="/Users/DIR_" & sf.Trim(sf.Upper(email.Text)) If File.Exists(File.DirInternal,"poidsww.db") Then dbx.upload(File.DirInternal,"poidsww.db",filename,"poidsww.db") End If Thanks !
DonManfred Expert Licensed User Longtime User Sep 1, 2019 #2 Please use [CODE]code here...[/CODE] tags when posting code. I never copied a sqlite db from the device to my dropbox but i would make sure the DB is Closed before uploading. - Close the DB - Wait a few ms (sleep(500)) - Upload the db to dropbox - Reopen DB Last edited: Sep 1, 2019 Upvote 0
Please use [CODE]code here...[/CODE] tags when posting code. I never copied a sqlite db from the device to my dropbox but i would make sure the DB is Closed before uploading. - Close the DB - Wait a few ms (sleep(500)) - Upload the db to dropbox - Reopen DB
Erel B4X founder Staff member Licensed User Longtime User Sep 1, 2019 #3 06Pierrick06 said: Is there a magical property of File.Dirinternal I missed somewhere ? Click to expand... No. What is the output of: Code: Copy For Each f As String In File.ListFiles(File.DirInternal) Log(f) Next Upvote 0
06Pierrick06 said: Is there a magical property of File.Dirinternal I missed somewhere ? Click to expand... No. What is the output of: Code: Copy For Each f As String In File.ListFiles(File.DirInternal) Log(f) Next
06Pierrick06 Member Licensed User Sep 1, 2019 #4 Here is the return. My DB is last line + these 2 strange lines with "-shm" and "-wal" When I copy these 3 files instead of just ".db" it works like a charm !! I found here (https://www.sqlite.org/tempfiles.html) some explanations about these temporary files : -SHM is Shared Memory file - WAL is Write-Ahead Log Last edited: Sep 1, 2019 Upvote 0
Here is the return. My DB is last line + these 2 strange lines with "-shm" and "-wal" When I copy these 3 files instead of just ".db" it works like a charm !! I found here (https://www.sqlite.org/tempfiles.html) some explanations about these temporary files : -SHM is Shared Memory file - WAL is Write-Ahead Log
06Pierrick06 Member Licensed User Sep 1, 2019 #5 DonManfred said: I never copied a sqlite db from the device to my dropbox but i would make sure the DB is Closed before uploading. - Close the DB - Wait a few ms (sleep(500)) - Upload the db to dropbox - Reopen DB Click to expand... Thanks DonManfred for reply. I also tested with "sql.close" and a timer but result is the same. Thanks to Erel's proposal I found 2 other file extensions, "shm" and "wal" I had to copy as well. What is strange is that "sql.close" did not flush these 2 temp files. Last edited: Sep 1, 2019 Upvote 0
DonManfred said: I never copied a sqlite db from the device to my dropbox but i would make sure the DB is Closed before uploading. - Close the DB - Wait a few ms (sleep(500)) - Upload the db to dropbox - Reopen DB Click to expand... Thanks DonManfred for reply. I also tested with "sql.close" and a timer but result is the same. Thanks to Erel's proposal I found 2 other file extensions, "shm" and "wal" I had to copy as well. What is strange is that "sql.close" did not flush these 2 temp files.
Erel B4X founder Staff member Licensed User Longtime User Sep 1, 2019 #6 06Pierrick06 said: What is strange is that "sql.close" did not flush these 2 temp files. Click to expand... It is not strange. This is how it works in wal mode. You can switch to journal mode instead. Upvote 0
06Pierrick06 said: What is strange is that "sql.close" did not flush these 2 temp files. Click to expand... It is not strange. This is how it works in wal mode. You can switch to journal mode instead.