[Seaside] Progress bar for database query
philippe.marschall at gmail.com
Thu Oct 15 12:39:14 UTC 2015
On Thu, Oct 15, 2015 at 2:23 PM, dtrussardi at tiscali.it
<dtrussardi at tiscali.it> wrote:
> 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.
More information about the seaside