Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #262 $table->get() should allow empty parameters
Submitted: 2003-11-17 00:04 UTC
From: brat at naxs dot com Assigned:
Status: Bogus Package: DB_DataObject
PHP Version: 4.3.2 OS: Linux Mandrake
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 33 - 19 = ?

 
 [2003-11-17 00:04 UTC] brat at naxs dot com
Description: ------------ There is no easy way to request "select * from table" without using the $table->query() syntax, which does not return number of tuples selected. Simply commenting out (removing) the lines below will solve this issue at the expense of not trapping a call with no parameters (which I argue should not be an error anyway). From the current version 1.3: function get($k = null, $v = null) { global $_DB_DATAOBJECT; if (empty($_DB_DATAOBJECT['CONFIG'])) { DB_DataObject::_loadConfig(); } $keys = array(); if ($v === null) { $v = $k; $keys = $this->keys(); if (!$keys) { DB_DataObject::raiseError("No Keys available for {$this->__table}", DB_DATAOBJECT _ERROR_INVALIDCONFIG); return false; } $k = $keys[0]; } if (@$_DB_DATAOBJECT['CONFIG']['debug']) { $this->debug("$k $v " .print_r($keys,true), "GET"); } /* COMMENTED OUT BY BRAT 11/16/2003 if ($v === null) { DB_DataObject::raiseError("No Value specified for get", DB_DATAOBJECT_ERROR_INVALIDARGS); return false; } */ $this->$k = $v; return $this->find(1); }

Comments

 [2003-11-17 00:29 UTC] alan_k
$x = new DataObject_Sometable; $x->find(); while ($x->fetch()) { .... }