[Cartoweb-users] Calling PEAR DB functions

Alexandre Saunier alexandre.saunier at camptocamp.com
Mon Jan 8 04:00:31 EST 2007


Hello,

the solution described by Yves works indeed.
But it's faster to use some CartoWeb built-in static methods from the 
Utils class. For instance:

$sql = '...';
$someValidDsn = '...';
$someOptionsArray = array(...); // that's the options array from 
DB::connect()
Utils::getDb($db, $someValidDsn, $someOptionsArray);
$res = $db->query($sql);
Utils::checkDbError($res, 'Some error message');
//...

No need to require() or include() any file: the Utils class is always 
available.

AS

Max Ueda wrote:
> Hi,
> 
> I've been trying to call some PEAR functions at my
> plugins, with no success. How can I have access to the
> functions  getOne(),  getRow(),  getCol(),  getAssoc()
> and  getAll()?
> 
> Thanks in advance,
> 
> Max Ueda


More information about the Cartoweb-users mailing list