Connecting Tech Pros Worldwide Forums | Help | Site Map

Database abstraction for PHP

Ruby Tuesday
Guest
 
Posts: n/a
#1: Jul 17 '05
Which one is better to do dynamic websites using MySQL? Thanks

a.. ADODB, http://php.weblogs.com/ADOdb/
b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib



Phil Roberts
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Database abstraction for PHP


With total disregard for any kind of safety measures "Ruby
Tuesday" <rubytuezdayz@yahoo.com> leapt forth and uttered:
[color=blue]
> Which one is better to do dynamic websites using MySQL? Thanks
>
> a.. ADODB, http://php.weblogs.com/ADOdb/
> b.. Metabase,
> http://www.phpclasses.org/browse.html/package/20.html c..
> PEAR::DB, http://pear.php.net/manual/en/core.db.php d.. PHPLib
> database wrappers, http://sourceforge.net/projects/phplib
>
>
>[/color]

Define "better". They're all perfectly fine for dynamic websites...

--
Phil Roberts | Nobody In Particular | http://www.flatnet.net/
Ruby Tuesday
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Database abstraction for PHP


For those who are familiar with all the below, which one is the easiest(and
using the smallest amount coding) to build a descent looking(with images and
forms) dynamic websites that is using MySQL/PHP/Apache.

Thanks

"Phil Roberts" <philrob@HOLYflatnetSHIT.net> wrote in message
news:Xns948EE9B5676F4philroberts@216.196.97.132...[color=blue]
> With total disregard for any kind of safety measures "Ruby
> Tuesday" <rubytuezdayz@yahoo.com> leapt forth and uttered:
>[color=green]
> > Which one is better to do dynamic websites using MySQL? Thanks
> >
> > a.. ADODB, http://php.weblogs.com/ADOdb/
> > b.. Metabase,
> > http://www.phpclasses.org/browse.html/package/20.html c..
> > PEAR::DB, http://pear.php.net/manual/en/core.db.php d.. PHPLib
> > database wrappers, http://sourceforge.net/projects/phplib
> >
> >
> >[/color]
>
> Define "better". They're all perfectly fine for dynamic websites...
>
> --
> Phil Roberts | Nobody In Particular | http://www.flatnet.net/[/color]


R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Database abstraction for PHP


"Ruby Tuesday" <rubytuezdayz@yahoo.com> wrote in message news:<c0jfds$17q3ro$1@ID-205437.news.uni-berlin.de>...[color=blue]
> Which one is better to do dynamic websites using MySQL? Thanks
>
> a.. ADODB, http://php.weblogs.com/ADOdb/
> b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
> c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
> d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib[/color]

In the company I work for, we're preparing some framework for our
projects. When we tried the above, we find that they all go for "too
much" abstraction---which is somewhat messy. Say for example, they
check the choosen DB and then use the appropriate function for that
DB.

If you like procedural style, you better to go for
<http://in2.php.net/dbx>

For us, we decided to go for our simple abstraction so that when
to switch to another DB, just it is enough to touch the class alone.

Example:

class DB
{
//var ...
function DB() ///constructor
{
///...
}
function dbConnect()
{
mysql_connect(); // or pg_connect(); or whatever
//...
}
function dbClose()
{
mysql_close(); // or pg_close(); or something else
//...
}
function dbQuery()
{
mysql_query();
//...
}
function dbFetchArray()
{
mysql_fetch_array();
//...
}
function dbGetError()
{
mysql_error();
}
function dbGetErrno()
{
mysql_errno();
}
}

--
"Success = 10% sweat + 90% tears"
If you live in USA, please support John Edwards.
Email: rrjanbiah-at-Y!com
Adams-Blake Company
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Database abstraction for PHP


Ruby Tuesday wrote:
[color=blue]
> Which one is better to do dynamic websites using MySQL? Thanks
>
> a.. ADODB, http://php.weblogs.com/ADOdb/
> b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
> c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
> d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib[/color]

We have had outstanding success with the ADODB package for our JAYA123
order-entry, invoicing web-service (http://www.jaya123.com). We tried the
fist three and thought all did a good job, were fast, easy to use, simple to
install, etc. We chose ADODB because it had some classes that allowed syntax
that was similar to how Microsoft Jet is coded and we have a lot of
experience on that platform from past lives, so our learning curve was a bit
flatter. I highly recommend ADODB, but the others are fine as well. I think
it will come down to personal preference. Try them all... there is no wrong
answer here IMO. YMMV.

Al Canton, Vice President
Adams-Blake Company, Inc.
***
JAYA123 - the new web-based total-office system for the
small biz. Order entry, billing, bookkeeping, etc. for $14.95
a month. Everyone says "It's cool as a moose!!"
See why at:http://www.jaya123.com
***

Chung Leong
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Database abstraction for PHP


In my case they provide too little abstraction. I wanted to isolate the
database, queries et al, completely from the application code. For my own
abstraction layer, it was more straight forward to call the PHP functions
directly.

Uzytkownik "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> napisal w
wiadomosci news:abc4d8b8.0402132303.4797b48d@posting.google.c om...[color=blue]
> "Ruby Tuesday" <rubytuezdayz@yahoo.com> wrote in message[/color]
news:<c0jfds$17q3ro$1@ID-205437.news.uni-berlin.de>...[color=blue][color=green]
> > Which one is better to do dynamic websites using MySQL? Thanks
> >
> > a.. ADODB, http://php.weblogs.com/ADOdb/
> > b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
> > c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
> > d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib[/color]
>
> In the company I work for, we're preparing some framework for our
> projects. When we tried the above, we find that they all go for "too
> much" abstraction---which is somewhat messy. Say for example, they
> check the choosen DB and then use the appropriate function for that
> DB.
>
> If you like procedural style, you better to go for
> <http://in2.php.net/dbx>
>
> For us, we decided to go for our simple abstraction so that when
> to switch to another DB, just it is enough to touch the class alone.
>
> Example:
>
> class DB
> {
> //var ...
> function DB() ///constructor
> {
> ///...
> }
> function dbConnect()
> {
> mysql_connect(); // or pg_connect(); or whatever
> //...
> }
> function dbClose()
> {
> mysql_close(); // or pg_close(); or something else
> //...
> }
> function dbQuery()
> {
> mysql_query();
> //...
> }
> function dbFetchArray()
> {
> mysql_fetch_array();
> //...
> }
> function dbGetError()
> {
> mysql_error();
> }
> function dbGetErrno()
> {
> mysql_errno();
> }
> }
>
> --
> "Success = 10% sweat + 90% tears"
> If you live in USA, please support John Edwards.
> Email: rrjanbiah-at-Y!com[/color]


Ruby Tuesday
Guest
 
Posts: n/a
#7: Jul 17 '05

re: Database abstraction for PHP


Thanks to all. Perhaps anyone can narrow it down to just one or two
selection where I can do the following easily:

- database search, add, replace, edit ..
- database paging of the result set
- have a nice(don't have to be fancy) forms display
- easily maintain
- less coding
etc

Thanks
"Ruby Tuesday" <rubytuezdayz@yahoo.com> wrote in message
news:c0jfds$17q3ro$1@ID-205437.news.uni-berlin.de...[color=blue]
> Which one is better to do dynamic websites using MySQL? Thanks
>
> a.. ADODB, http://php.weblogs.com/ADOdb/
> b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
> c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
> d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib
>
>[/color]


Manuel Lemos
Guest
 
Posts: n/a
#8: Jul 17 '05

re: Database abstraction for PHP


Hello,

On 02/16/2004 03:26 AM, Ruby Tuesday wrote:[color=blue]
> Thanks to all. Perhaps anyone can narrow it down to just one or two
> selection where I can do the following easily:
>
> - database search, add, replace, edit ..
> - database paging of the result set
> - have a nice(don't have to be fancy) forms display
> - easily maintain
> - less coding
> etc[/color]

I think you want something that goes beyhond just database abstraction.

You may want to try Metastorage. This is a tool that will generate data
access object classes from a simple data model definition. It wraps you
database tables into classes as if the your table rows were objects of
those classes.

Metastorage also generates classes that installs the database schema for
you as well generate forms that handle common types of manipulations
like creating new objects (table row entries).

Forms presentation is defined from themes that can be chosen from a
pre-defined selection that makes your Web forms look like familiar
desktop OS applications or you can design your own with your templates.

As a bonus, it generates nice UML class diagrams to let you make a good
impression your boss or your clients.

Take a look at the screenshots here:

http://www.meta-language.net/screenshots.html

Find all about Metastorage here:

http://www.meta-language.net/metastorage.html


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Tony Marston
Guest
 
Posts: n/a
#9: Jul 17 '05

re: Database abstraction for PHP


If you are interested in the 3 tier architecture where the presentation,
business and data access layers are all separate then have a look at
http://www.tonymarston.co.uk/php-mys...plication.html

Tony Marston
http://www.tonymarston.net

"Ruby Tuesday" <rubytuezdayz@yahoo.com> wrote in message
news:c0pnqa$19ilps$1@ID-205437.news.uni-berlin.de...[color=blue]
> Thanks to all. Perhaps anyone can narrow it down to just one or two
> selection where I can do the following easily:
>
> - database search, add, replace, edit ..
> - database paging of the result set
> - have a nice(don't have to be fancy) forms display
> - easily maintain
> - less coding
> etc
>
> Thanks
> "Ruby Tuesday" <rubytuezdayz@yahoo.com> wrote in message
> news:c0jfds$17q3ro$1@ID-205437.news.uni-berlin.de...[color=green]
> > Which one is better to do dynamic websites using MySQL? Thanks
> >
> > a.. ADODB, http://php.weblogs.com/ADOdb/
> > b.. Metabase, http://www.phpclasses.org/browse.html/package/20.html
> > c.. PEAR::DB, http://pear.php.net/manual/en/core.db.php
> > d.. PHPLib database wrappers, http://sourceforge.net/projects/phplib
> >
> >[/color]
>
>[/color]


Phil Roberts
Guest
 
Posts: n/a
#10: Jul 17 '05

re: Database abstraction for PHP


With total disregard for any kind of safety measures "Ruby
Tuesday" <rubytuezdayz@yahoo.com> leapt forth and uttered:
[color=blue]
> Thanks to all. Perhaps anyone can narrow it down to just one or
> two selection where I can do the following easily:
>
> - database search, add, replace, edit ..
> - database paging of the result set
> - have a nice(don't have to be fancy) forms display
> - easily maintain
> - less coding
> etc
>
> Thanks[/color]

For those kind of features it might be worth checking out the Web
Application Component Toolkit project http://wact.sourceforge.net/

It features some nice database abstraction, provides a
compatibility layer for both PEAR::DB and ADODB, has a Paging
feature and has a very cool template engine. You can implement a
paged recordset with only a few lines of PHP code.

--
Phil Roberts | Nobody In Particular | http://www.flatnet.net/
Closed Thread