Hi Gregory,

 

That's a good point that there are at least some PDO attributes that
need to be specified at construction time.

The workaround we currently have of setting attributes like
$db->getConnection()->setAttribute() is temporary.  

I do hope to resolve ZF-285 in the next iteration.

 

Regards,

Bill Karwin

 

 

________________________________

From: Gregory Szorc [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 21, 2007 2:59 PM
To: Sam Davey
Cc: [email protected]
Subject: Re: [fw-general] RE: Zend_Db - setting PDO attribute

 

I needed to set PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, which can only be
effectively set at PDO construction time
(http://framework.zend.com/issues/browse/ZF-285#action_10624 ).  I
extended Zend_Db_Adapter_Pdo_Mysql, copied _connect() in its entirety,
then modified to pass the appropriate array to the PDO constructor in
that function.  Hacky solution, but the only way to do it until ZF-285
is resolved. 

Gregory Szorc
[EMAIL PROTECTED]

On 2/20/07, Sam Davey < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:


Thanks Bill,

I am running ZF 0.7 therefore I had to add the following line to the 
Zend/Db/Adapter/Abstract.php file as per the info on the URI you posted
$this->_connect();

Obviously I shouldn't edit any library files but I did it as a quick fix
since 0.8 will be released soon.

Once I had done this I could include the following code without problem:
$db->getConnection()->setAttribute (PDO::ATTR_EMULATE_PREPARES, true);

The DB interaction is fixed so I'm sorted (finally).  I hope this 
information helps anyone else who is having problems with PDO.

I'd be interested to find out why I need to set this attribute for PDO
on
this server? and given that the information at this resource suggests
this 
is an optimal setting should it always be set?
http://netevil.org/node.php?nid=795&SC=1

Cheers,

Sam
--
View this message in context:
http://www.nabble.com/Zend_Db---setting-PDO-attribute-tf3263396s16154.ht
ml#a9072630
Sent from the Zend Framework mailing list archive at Nabble.com.

 

Reply via email to