RE: [PEAR] PHP::Pear::DB

From: Date: Fri, 19 Sep 2003 11:58:51 +0000
Subject: RE: [PEAR] PHP::Pear::DB
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7919@lists.php.net to get a copy of this message
Yes, this is my current solution: ---- file PHP/PEAR/DB/mysql_log.php ---- require_once "DB/mysql.php"; class DB_mysql_log extends DB_mysql { /*function DB_mysql_log () { parent::DB_mysql(); }*/ function &query($query, $params = array()) { // logging function here return parent::query($query, $params); } } ----------------------------------------- connect using: DB:connect('mysql_log://...'); Thanks to confirm that my solution is not too bad :-) Patrick Allaert -----Original Message----- From: Stefan Neufeind [mailto:stefan@neufeind.net] Sent: 19 September 2003 13:38 To: pear-general@lists.php.net Cc: patrick.allaert@belgacom.be Subject: Re: [PEAR] PHP::Pear::DB On 19 Sep 2003 at 13:31, patrick.allaert@belgacom.be wrote: > Just a simple question: > > I would like to log every queries passed to a DB object, since I am > using DB::connect() (who return me a DB_Common object) to connect to > my MySQL DB. > > Of course I could create a function who log the query and then query > the database... but this is not the OO way ! > > Does someone have an idea on how to personalize the behavior of a > function like DB_Common::query() without modifying original files and > in a OO way ? Hi, could you maybe extend the driver (write your "mymysqldriver" driver) which simply extends the original one? Don't know if this is the best solution - but maybe it helps you for an inspiration. Should be easy to write - and all you need to change is the driver when connecting. Stefan **** DISCLAIMER **** "This e-mail and any attachments thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s)named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation."

« previous php.pear.general (#7919) next »