cvs: pearweb /include pear-database.php

From: Date: Wed, 29 May 2002 22:13:41 +0000
Subject: cvs: pearweb /include pear-database.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4279@lists.php.net to get a copy of this message
mj Wed May 29 18:13:41 2002 EDT Modified files: /pearweb/include pear-database.php Log: * Add package::listAllwithReleases # Work in progress. Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.92 pearweb/include/pear-database.php:1.93 --- pearweb/include/pear-database.php:1.92 Tue May 21 07:36:01 2002 +++ pearweb/include/pear-database.php Wed May 29 18:13:41 2002 @@ -17,7 +17,7 @@ | Tomas V.V.Cox <cox@php.net> | | Martin Jansen <mj@php.net> | +----------------------------------------------------------------------+ - $Id: pear-database.php,v 1.92 2002/05/21 11:36:01 cox Exp $ + $Id: pear-database.php,v 1.93 2002/05/29 22:13:41 mj Exp $ */ require_once 'DB/storage.php'; @@ -342,6 +342,39 @@ } } return $packageinfo; + } + + // }}} + + // {{{ proto struct package::listAllwithReleases() + + /** + * Get list of packages and their releases + * + * @access public + * @return array + * @static + */ + function listAllwithReleases() + { + global $dbh; + + $query = "SELECT p.id AS pid, p.name, r.id AS rid, r.version, r.state FROM packages p, releases r WHERE p.id = r.package ORDER BY p.name"; + $sth = $dbh->query($query); + + if (DB::isError($sth)) { + return $sth; + } + + while ($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) { + $packages[$row['pid']]['name'] = $row['name']; + $packages[$row['pid']]['releases'][] = array('id' => $row['rid'], + 'version' => $row['version'], + 'state' => $row['state'] + ); + } + + return $packages; } // }}}

« previous php.pear.cvs (#4279) next »