Re: [PHP] Re: [PEAR] Re: PEAR DB 1.6.0 has been released

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

 



Richard Davey wrote:

Hello Justin,

Monday, February 23, 2004, 4:11:40 PM, you wrote:

JP>    3) A unified architecture for mysql and Oracle. You don't have to
JP> remember different functions for use with different databases.

That abstraction only abstracts the functions to connect to, select and
query the database, surely? Oracle/SQL Server/MySQL all use slightly
different SQL syntax - so if the query you pass in has to be unique
depending on the database in hand - you're already having to remember
a stack of system specific SQL and will have to code your application
to take into consideration all of those different syntax.

What I'm trying to say is that abstracting the connection to the
database is the easy part, writing an application that will support
them all is another matter.


Very true. In that case, you can use a package such as DB_DataObject or DB_QueryTool to abstract the SQL as well.


Or you can use fairly simple SQL with just a few rules and you should be fine. For instance, always select columns as upper case (for Oracle compatibility) or always convert them to lower case (DB_PORTABILITY_LOWERCASE), always use DB::quoteSmart() for values and DB::quoteIdentifier() for table / column names, etc.

The real hairy part is dealing with joins as the syntax is very different across the DBs. This can be solved by simply not doing them or using a syntax that most use. Or you can try to use DB_DataObject, but I'm not sure it works for all DBs yet.

--
paperCrane <Justin Patrin>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux