PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_QueryTool » Bug #7580

getOne

Details

Request #7580getOne
Submitted2006-05-08 18:06 UTC
Fromdeelight at f-m dot fm
Assignedquipo
StatusClosed
PackageDB_QueryTool
PHP Version5.1.2
OSWindows XP
Roadmaps(Not assigned)

Comments

[2006-05-08 18:06 UTC] deelight at f-m dot fm

Description:
------------
Unless I missed something, I don't think it's currently possible to do this. It would be very usefull to have something like DB's getOne to get the first column of the first row from a query result.

Test script:
---------------
$dbCategory->reset();
$dbCategory->setSelect('MAX(position)');
$res = $dbCategory->getOne();

// $res would contain the highest position

[2006-05-08 18:15 UTC] deelight at f-m dot fm

forgot to mention, that right now, to achieve the result, I use DB's getOne combined with DB_QueryTool's getQueryString:

$dbCategory->reset();
$dbCategory->setSelect('MAX(position)');
$res = $db->getOne($dbCategory->getQueryString());