I took a look at your example and need to study it because it seems a bit complicated for me. I’m puzzled by the fact that to do what I’m asking requires more complicated steps than expected.
At this point I was wondering: if I wanted to increment a progress bar with real values during a “Select…” command, how can I do it since the command is synchronous?
That is, how can I display the progress during the execution of the select?
It really depends on what your database situation is - for example if you are using SQLite where the database is on the same disk as your app, the SELECT command will probably run in a few milliseconds - so there’s literally no need to (or enough time to) deal with a progressBar.
If your database is remote and much slower, then perhaps you would want to break up your SELECT statement using LIMIT and OFFSET to return batches of results, like this:
SELECT column1, column2, ... FROM table_name LIMIT 100 OFFSET 0;
[update the UI]
SELECT column1, column2, ... FROM table_name LIMIT 100 OFFSET 100;
[update the UI]
SELECT column1, column2, ... FROM table_name LIMIT 100 OFFSET 200;
... etc...
It’s probable that this batch approach will be slower overall than doing a single SELECT statement.
However, an actively updating User Interface can also “feel” better from the user’s perspective, even if it’s slower overall - it’s a tradeoff.
What works best for your app will depend on the details.