[Phplib-trackers] [ phplib-Bugs-470493 ] bug in db_mysql.inc function lock (?)
Brought to you by:
nhruby,
richardarcher
|
From: <no...@so...> - 2002-04-09 19:24:41
|
Bugs item #470493, was opened at 2001-10-12 07:21 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=403611&aid=470493&group_id=31885 Category: None Group: None Status: Closed Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Layne Weathers (layne_weathers) Summary: bug in db_mysql.inc function lock (?) Initial Comment: Hello, Line 174 of the file db_mysql.inc (v. phplib-7.2d) if ($key=="read" && $key!=0) This test looks strange. $key!=0 will only be evaluated when $key=="read" so the next test $key!=0 is not usefull as we already knows that $key is "read" when we enter the second part of the test. As you put the mode "write" or "read" in the variable $mode I presume it's a typo error and the test should be if ($mode=="read"...) /* 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) { <======= HERE $query.="$value read, "; } else { $query.="$value $mode, "; } } $query=substr($query,0,-2); Kind regards, Olivier Boudry ---------------------------------------------------------------------- Comment By: NickM (terado) Date: 2002-04-09 19:24 Message: Logged In: YES user_id=501841 oops, ignore that - meant to go in other locking bug :"> sorry ---------------------------------------------------------------------- Comment By: NickM (terado) Date: 2002-04-09 19:20 Message: Logged In: YES user_id=501841 I find this extremely confusing, and unclear. Especially the fact that one way goes from table list to mode and the other from mode to table list, but I can adjust to the logic :) If not a bug in code this certainly is a docs bug, the examples would do well in with the description at least. Secondly - the following method does not work: $db->lock("dj, dj2music_cats as dj2mc, music_cats as mc", "read"); Now this can be achieved using the array method, but both ought to work. Thirdly (side thing) the changes were in the CVS, I was using the release version. Cant the bug logging form allow identification of which version the bug is being logged against. ---------------------------------------------------------------------- Comment By: Layne Weathers (layne_weathers) Date: 2001-10-12 16:10 Message: Logged In: YES user_id=278685 In addition to this issue, I am disturbed by 1) lock() only allowing 'read' and 'write' as locking modes and 2) neither lock() nor unlock() use the query(). ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=403611&aid=470493&group_id=31885 |