Jump to content

Database abstraction


dbo

Recommended Posts

Looking for some views on the best approach for coming up with a database abstraction layer. Obviously I want a standard interface to work with, but the main concern is being able to keep from marrying my application to any particular database. I've been researching a bit and see the following options.

 

Custom - lightweight, takes some time to build, must research the individual interfaces to make sure the interface will truly be standard (accept appropriate number of parameters, etc)

 

PDO - lightweight, requires additional extensions be installed on your server... my current host only allows for sqlite

 

Pear::DB - bulky and slower, requires Pear... other than being inefficient due to bloat seems to be robust

 

ADO - don't know much about this one

 

I dunno, each solution seems to have its positives and negatives. Struggling with which route I should go. Some of the concerns I'm struggling with are as follows:

 

-True standard interface

-Ease of implementation

-Minimal additional requirements

-Efficiency

-Works today and tomorrow... not experimental

 

Anyways, as usual it's just some random firings that are going in my head. I'm looking for some advice and suggestions from your own personal experiences. Thanks!

Link to comment
Share on other sites

I take that back, Pear::DB apparently has a younger... more slim brother MDB2.

 

I must say, I'm more partial to using Pear modules since PHP6 is supposedly going to be relying on it more heavily (presumably to increase the popularity of Pear). I've heard native mysql functions will be inside of Pear in PHP6, rather than in the core... I dunno though. I've not followed it extensively.

Link to comment
Share on other sites

I've heard native mysql functions will be inside of Pear in PHP6, rather than in the core... I dunno though. I've not followed it extensively.

 

I would assume that meens PECL as mysql* is an extension written in C, not native php.

 

I really think you ought to reconsider PDO. It (and the sqlite driver) ships with php5 by default (though you still need to make sure the required drivers (ie mysql/postgres etc etc) are installed) and is an extension written in C (not a native php lib), this usually makes things much quicker.

Link to comment
Share on other sites

I've heard native mysql functions will be inside of Pear in PHP6, rather than in the core... I dunno though. I've not followed it extensively.

 

I would assume that meens PECL as mysql* is an extension written in C, not native php.

 

I really think you ought to reconsider PDO. It (and the sqlite driver) ships with php5 by default (though you still need to make sure the required drivers (ie mysql/postgres etc etc) are installed) and is an extension written in C (not a native php lib), this usually makes things much quicker.

 

Even more proof of how little I've followed it :P

 

I'm talking to my host right now. They're basically saying that they can't enable other extensions for PDO. I'll push a little harder to see if they can accommodate me, but I don't have very high expectations.

Link to comment
Share on other sites

if your host won't enable any other drivers for PDO Id'e suggest finding a better host. as far as I'm aware, PDO is the future of database interaction with php.

 

From what a gather (here) if anything, all database API's will be moved into PECL except PDO which looks like will be pushed as the default database access method.

Link to comment
Share on other sites

I take that back, Pear::DB apparently has a younger... more slim brother MDB2.

 

I must say, I'm more partial to using Pear modules since PHP6 is supposedly going to be relying on it more heavily (presumably to increase the popularity of Pear). I've heard native mysql functions will be inside of Pear in PHP6, rather than in the core... I dunno though. I've not followed it extensively.

 

I really hope this is not true as that would make things slower(I mean the current mysql functions and other database function are written in C rather than something like pear with is PHP).  I mean if they really want to push PEAR, build PEAR's functionality into the core of PHP not the other way around.

Link to comment
Share on other sites

let me see if i understand correctly, allof the mysql_*, mssql_*, etcc are going to be removed and put into the PECL, wont that brake alot of php5 => php6 code?

 

The link I pointed to indicated that this was thought of, but for the time being decided against. That's how I read it anyway.

 

And no it wouldn't break any code, it would just mean that the required extensions would need to be installed via PECL. As it is now, the mysql extension is not built into php by default. All that moving it into PECL would mean is that there is an easier install method available.

Link to comment
Share on other sites

Is there any indication that if they push PDO to be the standard the mysqli drivers for it will be enabled by default?

 

Not that I've heard anywhere. Can't see why they would, both the mysql and mysqli extensions need to be explicitly enabled by default as it is now. This behavour was not that long ago changed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.