W WofaCle Member Oct 14, 2023 #1 Good day everyone, i trust you all doing well, When i update a table in my sqlite DB browser how do i make the changes take in effect in my App in b4A My special thanks to Mr. Erel for always been helpful to my question posted here Gradually my app is almost done and can't wait to share it here. Thank you.
Good day everyone, i trust you all doing well, When i update a table in my sqlite DB browser how do i make the changes take in effect in my App in b4A My special thanks to Mr. Erel for always been helpful to my question posted here Gradually my app is almost done and can't wait to share it here. Thank you.
Erel B4X founder Staff member Licensed User Longtime User Oct 15, 2023 #2 Where is the db file stored? On your PC? Upvote 0
aeric Expert Licensed User Longtime User Oct 15, 2023 #3 WofaCle said: Good day everyone, i trust you all doing well, When i update a table in my sqlite DB browser how do i make the changes take in effect in my App in b4A My special thanks to Mr. Erel for always been helpful to my question posted here Gradually my app is almost done and can't wait to share it here. Thank you. Click to expand... If you have added a file by copying to Files directory, it is Readonly. You need to copy the DB from Files.DirAssets to xui.DefaultDir or File.DirInternal. Upvote 0
WofaCle said: Good day everyone, i trust you all doing well, When i update a table in my sqlite DB browser how do i make the changes take in effect in my App in b4A My special thanks to Mr. Erel for always been helpful to my question posted here Gradually my app is almost done and can't wait to share it here. Thank you. Click to expand... If you have added a file by copying to Files directory, it is Readonly. You need to copy the DB from Files.DirAssets to xui.DefaultDir or File.DirInternal.
W WofaCle Member Oct 17, 2023 #4 Please i have added to app file folder and also inside B4A IDE i have also Added it there and i use the Starter module over there i have copied file.DirAssets and File.DirInternal Upvote 0
Please i have added to app file folder and also inside B4A IDE i have also Added it there and i use the Starter module over there i have copied file.DirAssets and File.DirInternal
Shelby Well-Known Member Licensed User Longtime User Oct 17, 2023 #5 WofaCle said: Please i have added to app file folder and also inside B4A IDE i have also Added it there and i use the Starter module over there i have copied file.DirAssets and File.DirInternal Click to expand... I use the db Browser; when I finish some edit, I click the button above called "Write Changes". That updates the db. Next time I Compile the project, the changes are shown. Also I use the following trick to update: Code: Copy If File.Exists(DBFileDir, DBFileName) = False Then '*SSS When False: Lets DB Browser update Log("db file does not exist") File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName) Log("db copied") Else Log("db file does exist") End If When: DBFileDir, DBFileName) =true: in my case, the updating fails. Last edited: Oct 17, 2023 Upvote 0
WofaCle said: Please i have added to app file folder and also inside B4A IDE i have also Added it there and i use the Starter module over there i have copied file.DirAssets and File.DirInternal Click to expand... I use the db Browser; when I finish some edit, I click the button above called "Write Changes". That updates the db. Next time I Compile the project, the changes are shown. Also I use the following trick to update: Code: Copy If File.Exists(DBFileDir, DBFileName) = False Then '*SSS When False: Lets DB Browser update Log("db file does not exist") File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName) Log("db copied") Else Log("db file does exist") End If When: DBFileDir, DBFileName) =true: in my case, the updating fails.
aeric Expert Licensed User Longtime User Oct 17, 2023 #6 After you made changes to the SQLite database in PC, replace the file in Files Manager tab. In B4A, delete the old file and then copy the new file from DirAssets to DirInternal like the first time you copy the file. B4X: Copy ' Do this only once after updated the db from DB Browser If File.Exists(xui.DefaultFolder, "database.db") Then File.Delete(xui.DefaultFolder, "database.db") File.Copy(File.DirAssets, "database.db", xui.DefaultFolder, "database.db") End If Upvote 0
After you made changes to the SQLite database in PC, replace the file in Files Manager tab. In B4A, delete the old file and then copy the new file from DirAssets to DirInternal like the first time you copy the file. B4X: Copy ' Do this only once after updated the db from DB Browser If File.Exists(xui.DefaultFolder, "database.db") Then File.Delete(xui.DefaultFolder, "database.db") File.Copy(File.DirAssets, "database.db", xui.DefaultFolder, "database.db") End If
Shelby Well-Known Member Licensed User Longtime User Oct 17, 2023 #7 One last thing about my above post: Try putting your IDE on Release in the upper right corner; the changes in Browser won't display if you are in debug mode. I actually leave mine in release mode most of the time. Also my entry is not the entire sub. I can give the entire sub if needed. It starts: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLay ..................... and so on. Upvote 0
One last thing about my above post: Try putting your IDE on Release in the upper right corner; the changes in Browser won't display if you are in debug mode. I actually leave mine in release mode most of the time. Also my entry is not the entire sub. I can give the entire sub if needed. It starts: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLay ..................... and so on.
mangojack Expert Licensed User Longtime User Oct 18, 2023 #8 Shelby said: I use the db Browser; when I finish some edit, I click the button above called "Write Changes". That updates the db. Next time I Compile the project, the changes are shown. Click to expand... Well , there's a wakeup call . I do exactly the same.. but then removed the dB from the IDE file tab, then re-added it back ! Dohhh ?? Upvote 0
Shelby said: I use the db Browser; when I finish some edit, I click the button above called "Write Changes". That updates the db. Next time I Compile the project, the changes are shown. Click to expand... Well , there's a wakeup call . I do exactly the same.. but then removed the dB from the IDE file tab, then re-added it back ! Dohhh ??
W WofaCle Member Oct 18, 2023 #9 Wow thank you all it working now but won't this be a problem like whenever i update the db browser database i have to remove the file and re upload it.... Anyway please if there's any other Way round kindly to me a favor with video tutorial thank you Upvote 0
Wow thank you all it working now but won't this be a problem like whenever i update the db browser database i have to remove the file and re upload it.... Anyway please if there's any other Way round kindly to me a favor with video tutorial thank you
Shelby Well-Known Member Licensed User Longtime User Oct 18, 2023 #10 Funny Jack, I did the same thing yesterday. Removed the dB from IDE file tab and this morning it took 30 minutes to figure out why my app wouldn't compile. Finally I put it back. Thanks for the wakeup call. Shelballs Upvote 0
Funny Jack, I did the same thing yesterday. Removed the dB from IDE file tab and this morning it took 30 minutes to figure out why my app wouldn't compile. Finally I put it back. Thanks for the wakeup call. Shelballs
aeric Expert Licensed User Longtime User Dec 10, 2023 #11 aeric said: ... Click to expand... WofaCle, I have no idea why my reply is funny to you. Upvote 0
Shelby Well-Known Member Licensed User Longtime User Dec 10, 2023 #12 Aeric, I could be wrong, but perhaps he's laughing at himself not previously recognizing your suggestion before you made it. Upvote 0
Aeric, I could be wrong, but perhaps he's laughing at himself not previously recognizing your suggestion before you made it.
Shelby Well-Known Member Licensed User Longtime User Dec 10, 2023 #13 WofaCle said: Wow thank you all it working now but won't this be a problem like whenever i update the db browser database i have to remove the file and re upload it.... Anyway please if there's any other Way round Click to expand... WofaCle, as I mentioned in post #5, I leave the word False as it is to enable future changes without delay. In other words, I never need to remove the file from the file tab in the IDE. Now I must add that my app isn't published yet so perhaps that will make a difference when it is published. Today 11/14/24 my app is published and all I mentioned here is satisfactory for the Google Play bots and so on. Last edited: Nov 14, 2024 Upvote 0
WofaCle said: Wow thank you all it working now but won't this be a problem like whenever i update the db browser database i have to remove the file and re upload it.... Anyway please if there's any other Way round Click to expand... WofaCle, as I mentioned in post #5, I leave the word False as it is to enable future changes without delay. In other words, I never need to remove the file from the file tab in the IDE. Now I must add that my app isn't published yet so perhaps that will make a difference when it is published. Today 11/14/24 my app is published and all I mentioned here is satisfactory for the Google Play bots and so on.