PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject » Bug #262

$table->get() should allow empty parameters

Details

Submitted2003-11-17 00:04 UTC
Frombrat at naxs dot com
StatusBogus
PackageDB_DataObject
PHP Version4.3.2
OSLinux Mandrake
Roadmaps(Not assigned)

Comments

[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);
}