At 15:56 -0800 3/4/03, William R. Mussatto wrote:
> At 23:19 +0000 3/4/03, Mamatha Balasubramanian wrote:
Thank you once again.
I have a web-interface that does search on a given text and I would
have a script that creates a temporary table. So according to you, in
my script, I just to need
create a temporary table and not have to worry about another client
using the same web interface (and thereby using the same program). Can
you please elaborate a little more on this?
Sure.
You are incorrect. :-)
That is, you're making an assumption that cannot necessarily be made. If
you can guarantee that the web script will establish a new connection,
and the connection will terminate when the script ends, you can indeed
do what you describe above.
But you *cannot* do that if you're running your script in an environment
that uses persistent connections that may be used by successive
instances of the script. PHP persistent connections fall into this
class, for example. Several requests might be served by the same
instance of the web server process, and you don't know that one request
won't be getting the connection used by a previous request. In that
case, the connection won't have closed, and the TEMPORARY table won't
have disappeared.
You can guard against this by issuing this query before creating the
TEMPORARY table:
DROP TABLE IF EXISTS tbl_name
Thanks,
Mamatha
Probably even better to have the Drop Table at the end of the script that
used it.
Not necessarily. If you create the table and then an error occurs,
you may not reach the point that drops the table. Then the next
instance of the script, which expects the table not to exist when
it creates it, will fail.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php