Original Content
  

Using the Zend Framework Without PDO

p. !>http://farm1.static.flickr.com/147/352002842_153484439e_m.jpg! David Coallier (#phpc regular) has posted a “quickie tutorial”:http://blog.agoraproduction.com/index.php?/archives/15-Zend-Framework-Without-PDO.html on his site about using the Zend Framework without PDO. In it he discusses how to use MDB2 with the Zend Framework instead of the Zend_DB and PDO. Here’s a quick quote to wrap your head around.

bq. For those who wanted to use the Zend Framework on server but didn’t have all the access to install PDO or such will now be able to do so. I have a fix that now MDB2 (PHP5 Only) can be used instead of PDO.

p. If you are a MDB2 fan but still want to use the Zend Framework or wanting to use the Zend Framework but didn’t have access to PDO, this is a good read. David has laid out a lot of code for you to peruse.

p. SIDE NOTE: Another option if you want to bypass PDO but use the Zend Framework is to use the new “MySQLi adapter”:http://framework.zend.com/wiki/display/ZFUSER/Zend_Db+Adapters+Overview in the “incubator”:http://framework.zend.com/wiki/display/ZFDOC/Home.

p. =C=

Published: January 9th, 2007 at 8:32
Categories: News, Zend Framework
Tags:

14 comments to “Using the Zend Framework Without PDO”

Just a little update, I have the code tarred if anyone is ready to try it or wants to venture into this dark world :-) .

Seriously, currently I’m redisigning the classes in order to make them fully compatible with ZF.

If anyone is interested, I can keep you up to date with the answer and news I get from the zend mailing list.

Thanks :-)

I’ve been using the Zend framework for quite a while now, and I have been REALLY enjoying it. It cuts down the amount of time I have to spend on a project by at least half. The one and only gripe I’ve had with it so far (other than interface changes –which is to be expected in a <1.0 framework) is that my host (a host I had no influence on deciding) doesn’t support pdo OR mysqli, so I’m not really left with very good options for database abstraction. Hopefully this is just what I’m looking for. Thanks!

Would it be possible to provide a link to the tarball or zip please?

Hey rushy2uk, I am currently having some people testing it for the next few days, but I still have to implement some functions into the Dbphp.php (Which is the main gate to MDB2) because it is not doing all the Zend_Db functions just yet.

I am planning on having it ready by Thursday (Thurs Jan, 10, 2007) to be usuable.

I currently have converted mysql/postgre/sqlite

I have a local version of mssql and I will be adding it tonight to the main tar.

However I have the first version here:
http://dev.agoraproduction.com/zend/ –> (0.0.4)

But I will be adding daily to this as I am converting new drivers.

You have to put the Php/ directory into Zend/Db/Adapter/

And the Db.php file in Zend/ . The only thing that changed in the Db.php factory is adding an elseif that handles the PHP_* driver call. Nothing more.

Let me know how it went.

D

I have just put up a new version there:

You can get the Zend/Db.php file there:
http://dev.agoraproduction.com/zend/Db.php

and you can get the Zend/Db/Adapter/Php directory there:
http://dev.agoraproduction.com/zend/Php-0.0.6.tar

This version has a new *structure* and support mysql/mssql/pgsql/oci8/sqlite

I still see some design problems and maintainability hell coming up but it should work until the next release.

Next one (tonight or tmrw) will have the main functions to query, etc.

Thanks

Downloaded the .tar file now, so thanx ;)

I will have it tested today and it will have all the main functions ready to be used by all the drivers.

By main functions I mean:

fetchAll() (Already Done)
fetchCol() (Already Done)
fetchRow() (Already Done)
fetchOne() (Already Done)
setFetchMode (Already Done)
query() (Already Done)

insert() (Done but Untested – fixing today)
update() (Done but Untested – fixing today)
select() (Implementing today)
quote() (Implementing today)
etc.

I have just added:
<a href="http://dev.agoraproduction.com/zend/Php-0.0.7.tar">http://dev.agoraproduction.com/zend/Php-0.0.7.tar</a&gt;

The next versions will have many changes as such as describeTable, and database management methods.

This version seems a little more stable than the other ones but might still be breaking at some point.

I am also planning on using Zend_Db_Exception for errors.

Thanks :-)

Here’s the latest release but this one is probably the most stable one and it works well with Zend_Db_Table.

Next it will go beta:

http://dev.agoraproduction.com/zend/Php-0.0.9.tar

For further releases just look at:
http://dev.agoraproduction.com/zend/

and use the latest version of Php-x.y.z.tar :-)

P.S. You can also stay updated there:
http://blog.agoraproduction.com/index.php?/archives/15-Zend-Framework-Without-PDO.html

Enjoy all!
Thanks

Hi, David.
I find that PDO for MSSQL 2005 driver not supported in zend framework 1.x.x.
Otherwise I find the SQL Server 2005 Driver for PHP in Microsoft website at here :
http://msdn.microsoft.com/en-us/library/cc296221.aspx

so can u implement the MDB2 Driver for sqlsrv Driver?
I am very happy if u can make the Driver soon.

-regards
Hendrayana

_____anonymous_____
August 12th, 2009 at 2:23 pm

Hi man,

Awesome idea, could make something a lot easier for me. However, the links aren’t working any more :(

Do you think you can post some other link to it, please?

Thanks a lot!
Cheers