RE: [PHPLIB] Caveat with PHP/PHPLib and MySQL Table Locking, and how to get out of trouble From: Arno A. Karner (karner <email protected>)
Date: 03/19/00

u may not want to call unlock tables, if it is done the way it is in
postgres sql, the code for unlock table submits sql command commit,
genraly speaking an error should not call commit, it should submit query
of abor or rollback.

My opinions are my own and not that of my employer even if I am self employed

On Mon, 20 Mar 2000, Michael Anthon wrote:

> > Therefore, I recommend that one set $mydbobject->Halt_On_Error to
> > "report" or "no" according to need, if one is using PHPLib, unless you
> > have a very strong need for the page to abort. In regular PHP one
> > should use your own methods to make sure that a MySQL error will not
> > cause the page to stop before the UNLOCK query is run.
>
> The other possibility here would be to subclass DB_Sql and replace the
> default halt() function with one that executes an "UNLOCK TABLES" before
> exiting. Something like...
> /***************************************************/
> class DB_Sql_Lock extends DB_Sql {
> var $classname = "DB_Sql_Lock";
>
> var $Host = "hostname";
> var $Database = "dbname";
> var $User = "username";
> var $Password = "password";
>
> function halt($msg) {
> $this->Error =  <email protected>($this->Link_ID);
> $this->Errno =  <email protected>($this->Link_ID);
> if ($this->Halt_On_Error == "no")
> return;
>
> $this->haltmsg($msg);
>
> if ($this->Halt_On_Error != "report")
>  <email protected>("UNLOCK TABLES",$this->Link_ID);
> die("Session halted.");
> }
> };
> /***************************************************/
>
> Have not tested this but I think it should work.
>
> Cheers
> Michael Anthon
> -
> PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
> To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
> the body, not the subject, of your message.
>

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.