fetchPairs method

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@86 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2009-05-05 11:44:06 +00:00
parent 0c98677b7d
commit f68625500a
2 changed files with 70 additions and 0 deletions

View File

@ -182,6 +182,28 @@ class ModelSelectResult extends ModelResult
}
return $array;
}
/**
* Fetches all SQL result rows as an array of key-value pairs.
*
* The first column is the key, the second column is the
* value.
*
* @return array
*/
public function fetchPairs()
{
if (!method_exists('DBConnector', 'fetchArray')) {
throw new Exception('Method not implemented yet.');
}
$data = array();
while ($row = DBConnector::fetchArray($this->result, DBConnector::FETCH_NUM)) {
$data[$row[0]] = $row[1];
}
return $data;
}
function count()
{