Dear Everyone
Could anyone tell me why my sqlite db file gets corrupted when I copy it?
The DB is located in the special folder documents for the app, I would then like to copy it to the special folder external documents at the end of the app / as it closes (which is the folder that a google drive app watches and syncs)
If I change the original location of the DB to external documents its fine, but if I try and copy it, it gets corrupted.
I've tried copying other things and they are also fine, just not the DB.
I think possibly its because there are open connections to the database at the time I'm trying to copy it, maybe?
Could someone tell me the simplest way to make sure all the connections are closed / whether this could be the problem / or what else it might be?
I have been using the put URL command btw.
As ever, any help very much appreciated.
Kind regards
Paul
sqlite corrupted when copied
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: sqlite corrupted when copied
What's the complete "put url" command you are using?
I think it sounds like your problem might just maybe perhaps be solved if you use "binfile:" instead of "file:" in the put url command? Potentially.
I think it sounds like your problem might just maybe perhaps be solved if you use "binfile:" instead of "file:" in the put url command? Potentially.
-
- Posts: 58
- Joined: Sat Jun 15, 2019 10:09 am
Re: sqlite corrupted when copied
Hi SparkOut
This is the code:-
command save_db_external
create folder specialFolderPath("external documents") & "/" & "upload folder"
put URL("file:" & specialFolderPath("external documents") & tdbname) into URL("file:" & specialFolderPath("external documents") & "/" & "upload folder" & tdbname)
end save_db_external
Thanks v much, I'll try what you suggest, what does the 'bin' bit mean btw?
Kind regards
Paul
This is the code:-
command save_db_external
create folder specialFolderPath("external documents") & "/" & "upload folder"
put URL("file:" & specialFolderPath("external documents") & tdbname) into URL("file:" & specialFolderPath("external documents") & "/" & "upload folder" & tdbname)
end save_db_external
Thanks v much, I'll try what you suggest, what does the 'bin' bit mean btw?
Kind regards
Paul
Re: sqlite corrupted when copied
"binfile:" is telling the engine to write the binary data file faithfully byte for byte.
"file:" is telling the engine to write a text file, where the engine will interpret the line endings and match to the current platform's convention.
Every time you need a binary faithful storage or retrieval, "binfile:" is what you need.
Also, it looks like you need an extra slash between "upload folder" and tdbname
"file:" is telling the engine to write a text file, where the engine will interpret the line endings and match to the current platform's convention.
Every time you need a binary faithful storage or retrieval, "binfile:" is what you need.
Also, it looks like you need an extra slash between "upload folder" and tdbname