[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] use of PEAR
From: |
Brent Kelly |
Subject: |
Re: [Phpgroupware-developers] use of PEAR |
Date: |
Mon, 17 Mar 2003 09:11:16 +1200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 |
I've been using ADOdb for the past year or so & it seems very flexible
and has a lot of nice features.
Aside from the ones already mentioned, other features I find very useful:
- Cross-DB SQL generation:
e.g. You can generate the sql for an insert simply by:
------------------------------------------------
//assuming Ralphs suggested implementation & that
$GLOBALS['phpgw']->adodb is an adodb connection object
//retrieve a blank recordset
$rs = $GLOBALS['phpgw']->adodb->Execute('SELECT * FROM news WHERE id = -1')
$fields = array (
'news_title' => 'this is a sample title',
'news_article' => 'this is the article for the sample',
'news_submitted' => $submitted
);
$GLOBALS['phpgw']->adodb->Execute(
$GLOBALS['phpgw']->adodb->GetInsertSQL($rs,$fields));
------------------------------------------------
That takes care off addslashes and all the other stuff required to
produce a db-specific insert statement. Updating can work very similar.
Another very useful feature is the ability to retrieve a 2-dimensional
array of all retrieved rows using the $rs->GetRows() function. I would
imagine this would be especially useful with the xslt implementation
being able to simply retrieve your recordset from the database and then use:
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('result' =>
$rs->GetRows()));
Obviously thats not tested but i'd imagine it would be somewhat handy
for dumping sql results to xml.
I'm not sure exactly how this compares to PEAR as I have never used it,
but from using ADOdb for a while it has proven to be a very flexible &
stable interface. It also appears to have an active development team (6
update releases so far this year already), which is always a plus :).
Regards,
Brent Kelly (aka weaky),
Zeald Ltd.
Lars Kneschke(priv.) wrote:
Ralf Becker <address@hidden> schrieb:
I had a look for ADOdb http://php.weblogs.com/ADODB
They support transactions, table-locking and tabelcreation.
Here are some links:
- comparison between ADOdb an PEAR::DB
http://php.weblogs.com/Compare_PEAR_DB_ADOdb
- table-creation and alteration in v. 3.30:
http://phplens.com/lens/lensforum/msgs.php?id=5455
Features i like too:
- Return the last auto-increment number.
- Replace function available.
Yes. When updating a record, we check if the record exists, and if it does
not, we insert the record instead, using ADOConnection::Replace( ).
- Code to provide database backed session variables.
Yes, two versions. One with encrypted data, one without.
Nice, to have.
Cu
--
Lars Kneschke
http://www.kneschke.de
written with FeLaMiMail
http://www.saunalahti.fi/sakarit/kerro-lisaa/bart.gif