I'm playing around with B4XTable and it looks very capable if I want cross platform support (B4A,B4i,B4J). I was going through the code from B4XPages_Sqlite2.zip and discovered it loads all of the rows from the SQLite table into a List. I'm wondering if what happens with a very large SQLite table that has 10k rows in it. Do we really need to load all 10k rows into a List called "Data" then execute "bxtTable.SetData(Data)" to load the list into bxtTable? Why not load only the 10 rows that are being displayed on the screen into the List (or buffer it with the first 100 rows)? This of course means the PgDn/PgUp navigation will have to use "Select ... from table ... limit 10 offset 9" and a filter will use the SQLite where clause and the SQLite "Order By" clause will be used to sort it.
Here is the code from the example app that I downloaded:
Am I on the right track if I want to handle a large SQLite table? Or did I miss something? I don't have the code for B4XTable so I can't see what it is doing internally.
TIA
Here is the code from the example app that I downloaded:
B4X:
'Shows the database in a table in a B4XTable
Public Sub ShowTable
Private Query As String
ReadDataBaseRowIDs 'All RowIds are loaded from the SQLite table
Query = "SELECT FirstName, LastName, City FROM persons"
'depending if the filter is active or not we add the filter query at the end of the query
'the filter query is defined in the Filter Activity
If Filter.flagFilterActive = False Then
btnFilter.Text = "Filter"
Else
btnFilter.Text = "UnFilter"
Query = Query & Filter.Query
End If
Dim Data As List
Data.Initialize
Dim rs As ResultSet = SQL1.ExecQuery(Query)
Do While rs.NextRow 'All data rows are added to the Data list.
Dim row(3) As Object
row(0) = rs.GetString("FirstName")
row(1) = rs.GetString("LastName")
row(2) = rs.GetString("City")
Data.Add(row)
Loop
rs.Close
bxtTable.SetData(Data) 'Load the List into bxTable
UpdateSelectedEntryDisplay
End Sub
Am I on the right track if I want to handle a large SQLite table? Or did I miss something? I don't have the code for B4XTable so I can't see what it is doing internally.
TIA