🟥 [FREE] SimpleSqlite - an extension for working with SQLite Databases

Don't remember this being an issue previously, not heard of this before. I have tested a 3 screen project in companion, with SimpleSqlite loaded in each screen (not doing anything) and I see no crashing.

Are you closing/unloading databases before switching screens ?

Do you need multiple real screens, you could probably use virtual screens for your app

I have attached the .aia file with modification adding Screen4 .

When the Search button in Screen1 is clicked, Screen4 opens but takes time and the app freezes.

Please, Let me know why it is so?

Thanks and regards
St
Bible (1).aia (515.2 KB)
ephen

I am looking

Why are you using V2 of SimpleSQLite? Use the latest version V4 which includes the listFixer method along with other improvements.

You appear to have got yourself into a muddle. You only have one bible database, so why does the user have to pick a file from Shared Directories ? Just import it to the main database from assets and work from there, or as I did in my previous example, download it to your ASD and set the filepath there.

Different real screens should be considered as different apps, you need to ensure you close the database on one screen before loading and opening the database on another. This I why I suggested virtual screens.

9 posts were split to a new topic: Error with apk build (own local AppInventor)


Hello TIMAI2,

I'm encountering a problem with the return values from what appears to be the sql.run function. It seems that if the query finds matching records, the function correctly returns the data. But if no records are found, it returns the string "SQL command completed" instead of an empty list.

This makes the data handling logic more complicated, as I have to check the result type before processing it.

What is the recommended way to handle this scenario? I was expecting an empty list for a query with no results.

Thanks for your help.

confirmed.

I will take a look, see what can be done.

Try this:

uk.co.metricrat.simplesqliteV4.12.aix (22.5 KB)

(needs testing "in the wild")

I have replaced:

    if (task.rows.size() == 0) {
      return YailList.makeList(Arrays.asList("SQL command completed"));
    } else {
      return YailList.makeList(task.rows);
    }

with

   if (sql.toLowerCase().contains("select") && task.rows.size() > -1) {
      return YailList.makeList(task.rows);
    }
    else if (task.rows.size() > 0) {
      return YailList.makeList(task.rows);
    } 
    else {
      return YailList.makeList(Arrays.asList("SQL command completed"));
    }
1 Like

I will try, thanks for your help