Android Question RDC copy remote MySQL records to local SQLite table

Declan

Well-Known Member
Licensed User
Longtime User
After a lengthy learning-curve, I have my RDC connection to my remote MySQL database running.
Many thanks to Erel and his tutorial:

My remote MySQL database contains a table that has 7 fields.
I would like to create a local SQLite database table that will also contain these 7 fields.
I then need to copy all the records from the remote MySQL database table to the new local SQLite database table.
My questions are:
How do I create a SQLite database and table on the local SD card?
How would I accomplish writing all the records from the remote MySQL table to the local SQLite table?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
How do I create a SQLite database and table on the local SD card?
See SQL tutorial and DBUtils.
https://www.b4x.com/search?query=SQL+Tutorial
https://www.b4x.com/search?query=DBUtils

How would I accomplish writing all the records from the remote MySQL table to the local SQLite table?
Create a command in the config file that selects all data. Run this command, download all data and then use DBUtil.InsertMaps to insert everything to the local database.
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
I have used DBUtils in another app to Delete and Create a table as follows:
B4X:
'Delete old tables and create new ones.
DBUtils.DropTable(SQL, "prodlisting")
  
'Create the "prodlisting" table which will holds data from MySQL database.
Dim m As Map
m.Initialize 'clear the map
m.Put("Id", DBUtils.DB_INTEGER)
m.Put("Description", DBUtils.DB_TEXT)
m.Put("Barcode", DBUtils.DB_TEXT)
m.Put("Category", DBUtils.DB_TEXT)
m.Put("Volume", DBUtils.DB_TEXT)
m.Put("GetMass", DBUtils.DB_TEXT)
m.Put("Supplier", DBUtils.DB_TEXT)
DBUtils.CreateTable(SQL, "prodlisting", m, "Id") '"Id" is primary key

How do I create this table on a SD card?
 
Upvote 0
Top