D Derek Jee Active Member Licensed User Longtime User Aug 14, 2015 #1 Hi there I install an SQLite db like this.. Code: Copy If File.Exists (File.DirDefaultExternal ,"My.db") = False Then File.Copy(File.DirAssets,"My.db",File.DirDefaultExternal ,"My.db") end if I always include the database with each install but want to be able to only copy from Dir.Assets if it has changed in structure. I understand you can't delete from Dir.Assets. Is there anywhere I can run this code which only runs on install? Any different advice is very welcome.. Kind regards, Derek.
Hi there I install an SQLite db like this.. Code: Copy If File.Exists (File.DirDefaultExternal ,"My.db") = False Then File.Copy(File.DirAssets,"My.db",File.DirDefaultExternal ,"My.db") end if I always include the database with each install but want to be able to only copy from Dir.Assets if it has changed in structure. I understand you can't delete from Dir.Assets. Is there anywhere I can run this code which only runs on install? Any different advice is very welcome.. Kind regards, Derek.
ac9ts Active Member Licensed User Longtime User Aug 14, 2015 #2 Add a table to the database that has a version code in it. At program start, copy the file from DirAssets to a temporary name, open, read the code, compare it to the "My.db" code and act accordingly. Unless it's a HUGE file, this should execute pretty quickly where the user doesn't notice. Upvote 0
Add a table to the database that has a version code in it. At program start, copy the file from DirAssets to a temporary name, open, read the code, compare it to the "My.db" code and act accordingly. Unless it's a HUGE file, this should execute pretty quickly where the user doesn't notice.
D Derek Jee Active Member Licensed User Longtime User Aug 14, 2015 #3 My thoughts exactly ;-) Thank you for the tip.. Upvote 0
ac9ts Active Member Licensed User Longtime User Aug 14, 2015 #4 I was just thinking, you can just as easily put a file in the assets directory (along with the table in your database) where the file has the version code. Then you won't have to copy the entire database to open it. Just read the file and compare to the installed database version code. Upvote 0
I was just thinking, you can just as easily put a file in the assets directory (along with the table in your database) where the file has the version code. Then you won't have to copy the entire database to open it. Just read the file and compare to the installed database version code.
D Derek Jee Active Member Licensed User Longtime User Aug 14, 2015 #5 So was I )) I have put a field in my db with the number in it, and a corresponding number in my app code.. When the new version is issued then the app number will compare to the existing db field and if different then copy the dir.assets db into the dir.internal and open that one.. That'll work too I think.. thank you for your thoughts especially being a Friday afternoon.. D Upvote 0
So was I )) I have put a field in my db with the number in it, and a corresponding number in my app code.. When the new version is issued then the app number will compare to the existing db field and if different then copy the dir.assets db into the dir.internal and open that one.. That'll work too I think.. thank you for your thoughts especially being a Friday afternoon.. D
ac9ts Active Member Licensed User Longtime User Aug 14, 2015 #6 thank you for your thoughts especially being a Friday afternoon.. Click to expand... Considering it was 7:50 AM (my time) when I came up with the first post.........I've got a while to wait for my afternoon Upvote 0
thank you for your thoughts especially being a Friday afternoon.. Click to expand... Considering it was 7:50 AM (my time) when I came up with the first post.........I've got a while to wait for my afternoon
D Derek Jee Active Member Licensed User Longtime User Aug 14, 2015 #7 Well you've got the whole day ahead of you!! Hope it is a great one!! Upvote 0