Re: Re: db_* => pg_*/my_*/ifx_* ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 01 October 2008 10:44:29 am Michelle Konzack wrote:
> Am 2008-09-30 19:58:03, schrieb Ashley Sheridan:
> > Hi Michelle, I'm not sure exactly what it is you're after. Are you
> > looking for software that will allow you to develop applications that
> > are database agnostic?
>
> What is "agnostic"?
>
> If you mean "database independant", the answer is yes.
>
> Most Applications do not need  complex  database  specific  queries  and
> generaly I need only
>
> db_connect($server, $port, $db, $user, $pass)
> 	1)  using pconnect if possibel
> 	2)  there are already significant differences
> 	    between pgsql and mysql
> db_error()
> 	1)  Works different between pgsql and mysql and ifx
>
> db_close($handle)
> 	1)  Works afaik with all databases the same way
>
> db_getarray()	-> return array from SELECT
> 	1)  Hell of SELECT FROM WHERE...
>
> db_insert($handle, $table, $what, $where)
> db_update($handle, $table, $what, $where)
> db_delete($handle, $table, $what, $where)
> 	1)  Sometimes heavy differences for ALL databases...

PHP does offer a unified API: PDO.

http://www.php.net/pdo

It offers a lot of good features, although it doesn't abstract out the SQL 
itself or some more annoying design limitations of some databases (like 
BLOB/CLOB handling in Postgres or Oracle).

I actually just recently finished (OK, it's not done yet but the bulk of it 
is) implementing a PDO-based fully OOP DB abstraction layer for Drupal 7.  
It's actually quite slick, but is still somewhat Drupal dependent right now 
due to the need to know the table structure ahead of time for non-MySQL 
databases.  Eventually I want to split it out to its own standalone library, 
but it's not at that point yet.  (And due to the weirdness that is SQL, it's 
actually a lot harder than you think to do such a thing well, especially 
WHERE clauses and the excitement that are Merge queries.  Tip: A simple array 
is NOT sufficient for all of what WHERE can do.)

-- 
Larry Garfield
larry@xxxxxxxxxxxxxxxx

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux