Here is what I am trying to do. Load a csv file into a sqlite database. This database will be used to read/write records to/from.
I have found this.
Dim su As StringUtils
Dim Table As List
Table = su.LoadCSV(File.DirAssets, "Trivia.csv", ",")
But I can't find the code to actually load the data into a table.
The first step it to create the table with DBUtils.CreateTable.
Then you need to iterate over the loaded data and convert it to a list of maps:
B4X:
Dim su As StringUtils
Dim Table As List
Table = su.LoadCSV(File.DirAssets, "Trivia.csv", ",")
Dim Table2 As List
Dim Items() As String
Table2.Initialize
For i = 0 To Table.Size - 1
Items = Table.Get(i)
Dim m As Map
m.Initialize
m.Put("column 1", Items(0)) 'You will need to replace the columns names with the correct names
m.Put("column 2", Items(1))
Table2.Add(m)
Next
DBUtils.InsertMaps(SQL, "YourTable", Table2)
Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'dbutils' is used before it was assigned any value.
Occurred on line: 113
DBUtils.InsertMaps(SQL, "Trivia", Table2)
You should add the DBUtils code module. Project - Add Existing module - Add DBUtils.bas (it is included in the zip file attached to the tutorial).
You also need to add a reference to SQL library.