XDB improvements.
Added methods to XDB namespace:
* XDB::fetchOne(Row|Assoc|Cell)
* XDB::fetchAll(Row|Assoc)
* XDB::fetchColumn
fetchAll(Row|Assoc) now take 2 optional arguments:
* a column to use as the as the key of the returned object
* a flag telling whether we allow simplification of the returned array if a key is defined and only one other column remain
e.g.:
$fids = XDB::fetchAllAssoc('name', 'SELECT fid, name FROM forums');
-> array('xorg.general' => '1', 'xorg.promo.x2003' => '2', ...)
$fids = XDB::fetchAllAssoc('name', true, 'SELECT fid, name FROM forums');
-> array('xorg.general' => array('fid' => '1'),
'xorg.promo.x2003' => array('fid => '2'), ...)
$fnames = XDB::fetchAllAssoc('fid', 'SELECT fid, name FROM forums');
-> array('1' => 'xorg.general', '2' => 'xorg.promo.2003', ...);
$f = XDB::fetchAllAssoc('SELECT fid, name FROM forums');
-> array(array('fid' => '1', 'name' => 'xorg.general'),
array('fid' => '2', 'name' => 'xorg.promo.x2003'),
...)
Note: Optional arguments given to XDB::fetch... MUST be given before the
query.
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>