>From: Jay Blanchard [mailto:jblanchard@stripped]
>Sent: Wednesday, June 03, 2009 8:46 AM
>To: Daevid Vincent; mysql@stripped
>Subject: RE: Why doesn't mySQL stop a query when the browser tab is
>I just noticed a horrible thing.
>Keep in mind that the query event is server side and is not tied to the
>browser (client side) once it has begun because of the statelessness of
>the connection. You would have to have some sort of onClose() event from
>the browser that would trigger a query cancellation.
[JS] Going beyond that, the browser is at several removes from the MySQL
server. Typically the browser talks to the web server, then the web server
runs some application code (PHP or whatever), and then the application code
talks to the MySQL server. The only part of this chain that "knows" what the
MySQL server is doing is the last bit, the application code, which is
typically waiting for a response.
Getting back to the user, HTTP itself is a stateless protocol. That means
the web server has no way of knowing if the user, the browser, or even the
user's computer is still there; it also doesn't really know what the user
last did (it's up to the application code to remember that somehow).
In order for an end user to cancel a query, there would have to be some way
for the user to tell the browser to tell the web server to tell the
application code to tell the MySQL server to stop. I'm pretty sure you could
create a "tired of waiting" button for the user, but I haven't done it
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
>MySQL General Mailing List
>For list archives: http://lists.mysql.com/mysql
>To unsubscribe: http://lists.mysql.com/mysql?unsub=1