Rusty Well-Known Member Licensed User Longtime User Dec 28, 2010 #1 1. Where does the simulator keep the built SQLlite tables? In memory/on disk... 2. Is there a way to copy an existing SQL database/tables into this (see above) location so it doesn't have to be dynamically created each time as in the samples?:sign0085:
1. Where does the simulator keep the built SQLlite tables? In memory/on disk... 2. Is there a way to copy an existing SQL database/tables into this (see above) location so it doesn't have to be dynamically created each time as in the samples?:sign0085:
Erel B4X founder Staff member Licensed User Longtime User Dec 29, 2010 #2 You can connect to the emulator with adb command (it is part of the Android sdk). You can call adb push to copy files to the emulator and adb pull to copy files from the emulator. You can also add the database in the Files tab and then copy it from the assets folder to the sd card when your program starts. See this post for example: http://www.b4x.com/forum/basic4andr...m-when-reading-sqlite-database.html#post40704 Upvote 0
You can connect to the emulator with adb command (it is part of the Android sdk). You can call adb push to copy files to the emulator and adb pull to copy files from the emulator. You can also add the database in the Files tab and then copy it from the assets folder to the sd card when your program starts. See this post for example: http://www.b4x.com/forum/basic4andr...m-when-reading-sqlite-database.html#post40704
tremara1 Active Member Licensed User Longtime User Dec 29, 2010 #3 copy existing db I used this code to copy an existing db from the dirassets to the sd card (DirDefaultExternal) if it does not already exist. It works in the emulator just make sure your emulator is set up with sd card support. Code: Copy If File.Exists(File.DirDefaultExternal,"meds.db") = False Then File.Copy(File.DirAssets,"meds.db",File.DirDefaultExternal,"meds.db") End If If SQL1.IsInitialized = False Then SQL1.Initialize(File.DirDefaultExternal, "meds.db", False) End If Upvote 0
copy existing db I used this code to copy an existing db from the dirassets to the sd card (DirDefaultExternal) if it does not already exist. It works in the emulator just make sure your emulator is set up with sd card support. Code: Copy If File.Exists(File.DirDefaultExternal,"meds.db") = False Then File.Copy(File.DirAssets,"meds.db",File.DirDefaultExternal,"meds.db") End If If SQL1.IsInitialized = False Then SQL1.Initialize(File.DirDefaultExternal, "meds.db", False) End If
Rusty Well-Known Member Licensed User Longtime User Dec 29, 2010 #4 Thanks! Works perfectly. Upvote 0