[Cartoweb-users] Calling PEAR DB functions

Max Ueda mhanzo at yahoo.com
Tue Jan 9 07:37:28 EST 2007


Oh, I got it!

Thank you Alexandre, everything is working the way I
need!

Regards,
Max

--- Alexandre Saunier
<alexandre.saunier at camptocamp.com> wrote:

> No problem, I've forgotten (doh!) to say that the
> $db/$res objects I've 
> quoted in my Utils example are PEAR::DB or
> PEAR::DB_Result objects => 
> you may then use them to call fetchRow() or any
> other PEAR::DB method.
> For instance :
> 
> Utils::getDb($db, $someValidDsn, $someOptionsArray);
> $res = $db->query($sql);
> Utils::checkDbError($res, 'Some error message');
> while ($row = $res->fetchRow()) {
>      // ...
> }
> 
> Max Ueda wrote:
> > Thanks Alexandre and Yves,
> > 
> > When I wrote this e-mail, I was intending to use
> > Alexandre's approach (calling the methods from the
> > Utils static class), with Yves' way of calling the
> > functions (I need getAll() from PEARDB). 
> > 
> > I think the right question shouldn't be the way
> I've
> > written (how to access the PEAR DB Methods), but
> the
> > following: Regarding some DB funcions such as 
> > fechRow() (I've been using this with no problem),
> what
> > other PEAR DB functions are avaliable at the Utils
> > class?
> > 
> > Thank you!
> > 
> > Max Ueda
> > 
> > 
> > 
> > --- Alexandre Saunier
> > <alexandre.saunier at camptocamp.com> wrote:
> > 
> > 
> >>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
> >>
> > 
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> > http://mail.yahoo.com 
> > _______________________________________________
> > Cartoweb-users mailing list
> > Cartoweb-users at lists.maptools.org
> >
>
http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 
> -- 
> Alexandre Saunier
> Camptocamp SA
> PSE A
> CH-1015 Lausanne
> 
> +41 21 619 10 19 (direct)
> +41 21 619 10 10 (centrale)
> +41 21 619 10 00 (fax)
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Cartoweb-users mailing list