"Octavian Rasnita" <[EMAIL PROTECTED]> wrote on 07/28/2005 02:18:05 PM:
> Hi, > > I am using a MySQL database on a web site, and I would like to know what > happends if someone searches in the database using a form, but after a few > seconds MySQL starts the query, that user hit the "Stop" button of the > browser. > Will MySQL continue its searching and also create the cache, or it will stop > automaticly? > > If it will also stop, can I do something to let it continue searching in > order to create the cache and the next time another visitor searches for the > same thing it will get the results from the cache? > > Sorry if this is a stupid question and thank you very much. > > Teddy > Here is what happens with nearly all web requests: 1) The browser (or some other tool) sends a message to a web server to get something. This usually because the user specifically asked for something, because an HTML page has tags in it for other content (like images), or by some other user action or client-side programming. Because you are specifically asking for "something" from the server, the specially formatted request is called either a Uniform Resource Locator (URL) or, in a more general sense, a Uniform Resource Identifier (URI). 2) the web server receives the URI and begins the process of providing what was requested. In the case of a scripted response, like your example, it make take some time for the server to complete assembling it's response. 3) the server responds with data/the browser receives the data. (Hopefully the browser will know what to do with whatever it asked for.) In your sample scenario, you said that between steps 2 and 3: 2.5) user clicks "STOP" in the browser. There aren't any messages in most of the internet protocols (HTTP, FTP, GOPHER, WAIS, etc) to cancel a response. The simplest thing for to do was to just ignore the response if it ever came. So to answer your question, the server doesn't know that the user is no longer interested in the information so it continues to process the request to its full and complete resolution. With some servers there are ways to detect if the browser is maintaining an open connection with the server (waiting on a response) but most server-side scripts do not check that status. Because they don't check that status, the script will not detect that the user has "hung up" waiting on it's response until it is ready to send the actual response data. The query completes, the cache is filled, and whatever effort went into formatting the response is just wasted. Since the user doesn't want it, the response is sent to the bit bucket. Make sense? Shawn Green Database Administrator Unimin Corporation - Spruce Pine