Re: Progress bar for database query

Philippe Marschall <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CA+LFMPjKSQzoYr1R343fHSqS=7S+NDS-KayZX6+aMBN8xZx5og@mail.gmail.com>
On Thu, Oct 15, 2015 at 2:23 PM, [email protected]
<[email protected]> wrote:
> Ciao,
>
>         i have a seaside application with some user interface.
>
>         Now i have one specific user request for query the database.
>
>         This request required some long time on the server before answer.
>
>         My goal is to :
>
>                 a) display a progress bar when the user submit this query
>
>                 b)  block the web user request until the server answer the data query result
>
>
>         How i can implemented this solution?

This is quite tricky, I would rather try to speed up the database query ;-)

First there's the question of how you get the progress of the query
itself. If you don't know in advance how may rows you expect or it's a
query that doesn't return a result (like an update) this can get
tricky. You could try to run and parse an EXPLAIN to get a guesstimate
of how many rows you will get. Or some databases allow you to check to
progress of a query in a different session.
Then there's the question of sending the progress updates to the
client. If you're on Zinc you can use it's WebSockets support. If
you're not and your sever adaptor supports flushing you can try to
implement Sever Sent Events.

Cheers
Philippe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.