Android Question File.dirinternal with Dropbox upload

06Pierrick06

Member
Licensed User
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 :

B4X:
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:

DonManfred

Expert
Licensed User
Longtime User
Please use [CODE]code here...[/CODE] tags when posting code.

codetag001.png

codetag002.png

codetag003.png


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:
Upvote 0

06Pierrick06

Member
Licensed User
Here is the return.
My DB is last line + these 2 strange lines with "-shm" and "-wal"

upload_2019-9-1_11-8-59.png


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:
Upvote 0

06Pierrick06

Member
Licensed User
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

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:
Upvote 0
Top