For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > August 2006 > Re: [PEAR] DB_DataObject and specific mysql client encoding









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] DB_DataObject and specific mysql client encoding
Justin Patrin

2006-08-28, 6:58 pm

On 8/28/06, Markus Fischer <markus@fischer.name> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Justin Patrin wrote:
>
> You mean, every time and at every place I factor a DataObject, I run
> something like
>
> $DO->getDatabaseConnection()->query("SET NAMES ...");
>
> ?
>
> But forgeting this at some point seems more error prone than having it
> part of DO ...
>


No, you only have to do this once for each database connection. I
would suggest doing it in the code that sets up the configuration for
your DOs. You *do* have that factored out, don't you?

It also makes sense to put this in the DO class, as you did, I was
just giving another possible solution which doesn't violate the
private method. Then again, I hack private stuff in my own code (and
even in a bit of PEAR code, but shhh, don't tell the QF devs).

--
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com