DB PDO setAttribute/getAttribute

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DB PDO setAttribute/getAttribute

Jan Helleman
I have a question, why is it not possible to use setAttribute and/or getAttribute for PDO with the Zend DB Class? It is very disturbing that my field names of the database all come out lower cased, while i am using capitals in my fieldnames...
 
Kind regards,
 
Jan Helleman
Reply | Threaded
Open this post in threaded view
|

Re: DB PDO setAttribute/getAttribute

Mislav Marohnić
Zend_Db does not subclass PDO but saves an instance of it in a protected property. You can use getConnection() to get the PDO object and set properties on it, but only after Zend_DB has already connected (it does not connect on instantiation, but waits for a first attempt to communicate with db).

If you look at Zend_Db_Adapter_Pdo_Abstract::_connect() method, you will see that forcing lowercase takes place.

So, the way to go is $mydb->getConnection()->setProperty(...) after you are sure Zend_Db has connected.

On 5/30/06, Jan Helleman <[hidden email]> wrote:
I have a question, why is it not possible to use setAttribute and/or getAttribute for PDO with the Zend DB Class? It is very disturbing that my field names of the database all come out lower cased, while i am using capitals in my fieldnames...
 
Kind regards,
 
Jan Helleman