Android Question SQLite - Limit (rows, columns, size) for Smartphones?

Mentalist

Member
Licensed User
Longtime User
Hello everyone,

I have a table with about 20 columns and everything is fine, when I just add some rows, but the app crashes when the table has more than ~1000 rows.
Is there any limit? Surely it will depend on the smartphone, but 4000 rows shouldn't be a problem - nowadays.

I'm still an absolute beginner. Am I doing something wrong?
B4X:
private Sub readSqlite
    Dim sql As SQL
    Dim rs As ResultSet
    sql.Initialize(File.DirInternal, "testsql.db", False)
    'File.Delete(File.DirInternal, "testsql.db")
   
If File.Exists(File.DirInternal, "testsql.db")= True  Then
    ToastMessageShow("File exists ... ", True)
Else        
        ToastMessageShow("File doesn't exist ... ", True)
End If
'    sql.ExecQuery("SELECT * FROM liste")
    rs = sql.ExecQuery("SELECT * FROM liste LIMIT 10")

    For i = 0 To 10
        rs.Position = i
        ListView.AddSingleLine(rs.GetString("Col1"))
    Next
    rs.Close
End Sub

Thanks in advance!
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
I'm still an absolute beginner.

Your approach to SQLite is not exactly the right approach, but you are only a beginner. You have to start somewhere., but your code looks ok, although needs a lot of cleaning up.
1. SQL should be declared in Globals or Process global.
2, If you rproject uses the default type project, you intialize the database only once: I Firstime then
3. With resultset, you use Do while. rs.Nextrow loop
4. xCustomlistview is the preferred way to listview.
5. If you are populating the listview with only col1, then don't use SELECT *. Use SELECT col1
6. Your best bet if you can upload your project including the database, someone will help you. There are a lot of SQLite knowledgeable members.
 
Upvote 1
Top