[Phplib-trackers] [ phplib-Bugs-541551 ] db_mysql lock tables
Brought to you by:
nhruby,
richardarcher
|
From: <no...@so...> - 2002-04-09 21:04:08
|
Bugs item #541551, was opened at 2002-04-09 14:02 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=403611&aid=541551&group_id=31885 Category: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: NickM (terado) Assigned to: Layne Weathers (layne_weathers) Summary: db_mysql lock tables Initial Comment: When issuing a lock command with an array of values, e.g.: $db->lock(array("table1"=>"read", "table2"=>"read")); this is resolved wrongly in the lock function, and instead attempts: lock tables read table1, read table2 now if the array is created the other way the obviously "read" would be the index and be overwritten!! Resolve: $key/$value other way around:- while (list($key,$value) = each($table)) { if (!is_int($key)) { // lock modes are "read", "read local", "write", "low priority write" $query .= "$key $value, "; } else { $query .= "$key $mode, "; } } ---------------------------------------------------------------------- >Comment By: NickM (terado) Date: 2002-04-09 21:04 Message: Logged In: YES user_id=501841 ei bogus, I did a half cut copy and paste from cvs, only half the lock function. You can slap me gently lol. btw thought group (being it says v1.0) was for classes of release, thats the only reason I mentioned it. Ta ---------------------------------------------------------------------- Comment By: Layne Weathers (layne_weathers) Date: 2002-04-09 20:24 Message: Logged In: YES user_id=278685 > 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. I agree that it is a confusing way for the function to function. Unfortunately, it was previously written that way and we don't want to break old code if we can help it, expecially in a point release. > 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. It does work in the current CVS version. I just ran this array of tests to make sure: (I temporarily modified lock() to echo "<p>$query"; so I could see the results) $db->lock("auth_user_md5 as a_u", "read"); $db->lock("auth_user as a_u, active_sessions a_s, db_sequence", "read"); $db->lock(array("read" => "auth_user as a_u")); $db->lock(array("read" => "auth_user as a_u, active_sessions a_s")); $db->lock(array("read" => "auth_user as a_u, active_sessions a_s", "write" => "db_sequence")); $db->lock(array("read" => "auth_user as a_u, active_sessions a_s", "write" => "db_sequence seq")); > 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. That would have to be taken up with SourceForge. ---------------------------------------------------------------------- Comment By: NickM (terado) Date: 2002-04-09 19:27 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. 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: 2002-04-09 16:19 Message: Logged In: YES user_id=278685 > When issuing a lock command with an array of values, > e.g.: > $db->lock(array("table1"=>"read", "table2"=>"read")); > > this is resolved wrongly in the lock function, and > instead attempts: > > lock tables read table1, read table2 That has never been the correct way to call lock(), even before the recent changes to lock(). The online documentation at <http://www.sanisoft.com/phplib/manual/DB_SqlMethods.php> was vague, so I added some examples. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=403611&aid=541551&group_id=31885 |