[Phplib-commit] CVS: php-lib-stable/php db_mysql.inc,1.7,1.8
Brought to you by:
nhruby,
richardarcher
From: Layne W. <lay...@us...> - 2001-10-12 16:16:19
|
Update of /cvsroot/phplib/php-lib-stable/php In directory usw-pr-cvs1:/tmp/cvs-serv25854/php Modified Files: db_mysql.inc Log Message: 1. use $this->query() in both lock() and unlock() 2. removed redundant check of the $table array key 3. remove lock()'s locking mode limit of "read" and "write" when multiple tables are locked "read local" and "low priority write" are both valid MySQL locks, but are not accepted by the previous function Index: db_mysql.inc =================================================================== RCS file: /cvsroot/phplib/php-lib-stable/php/db_mysql.inc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** db_mysql.inc 2001/08/21 02:20:04 1.7 --- db_mysql.inc 2001/10/12 16:16:16 1.8 *************** *** 166,187 **** /* public: table locking */ ! function lock($table, $mode="write") { ! $this->connect(); ! ! $query="lock tables "; if (is_array($table)) { ! while (list($key,$value)=each($table)) { ! if ($key=="read" && $key!=0) { ! $query.="$value read, "; } else { ! $query.="$value $mode, "; } } ! $query=substr($query,0,-2); } else { ! $query.="$table $mode"; } ! $res = @mysql_query($query, $this->Link_ID); ! if (!$res) { $this->halt("lock() failed."); return 0; --- 166,186 ---- /* public: table locking */ ! function lock($table, $mode = "write") { ! $query = "lock tables "; if (is_array($table)) { ! while (list($key,$value) = each($table)) { ! if (!is_int($key)) { ! // texts key are "read", "read local", "write", "low priority write" ! $query .= "$value $key, "; } else { ! $query .= "$value $mode, "; } } ! $query = substr($query,0,-2); } else { ! $query .= "$table $mode"; } ! $res = $this->query($query); ! if (!$res) { $this->halt("lock() failed."); return 0; *************** *** 191,200 **** function unlock() { ! $this->connect(); ! ! $res = @mysql_query("unlock tables", $this->Link_ID); if (!$res) { $this->halt("unlock() failed."); - return 0; } return $res; --- 190,196 ---- function unlock() { ! $res = $this->query("unlock tables"); if (!$res) { $this->halt("unlock() failed."); } return $res; |