From fbc1d9c3ec446b642e2f3ffaa017c74e90b66ef5 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 19 Jun 2007 21:16:04 +0000 Subject: [PATCH] --- lib/Doctrine/Connection/Profiler.php | 15 ++++++--------- lib/Doctrine/Connection/Statement.php | 27 ++++++++++++++++++++------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/lib/Doctrine/Connection/Profiler.php b/lib/Doctrine/Connection/Profiler.php index e6596c29d..1b51fa1a9 100644 --- a/lib/Doctrine/Connection/Profiler.php +++ b/lib/Doctrine/Connection/Profiler.php @@ -75,9 +75,9 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg */ public function __call($m, $a) { - // first argument should be an instance of Doctrine_Db_Event - if ( ! ($a[0] instanceof Doctrine_Db_Event)) { - throw new Doctrine_Connection_Profiler_Exception("Couldn't listen event. Event should be an instance of Doctrine_Db_Event."); + // first argument should be an instance of Doctrine_Event + if ( ! ($a[0] instanceof Doctrine_Event)) { + throw new Doctrine_Connection_Profiler_Exception("Couldn't listen event. Event should be an instance of Doctrine_Event."); } // event methods should start with 'on' @@ -86,18 +86,13 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg } if (substr($m, 2, 3) === 'Pre' && substr($m, 2, 7) !== 'Prepare') { - if ( ! in_array(strtolower(substr($m, 5)), $this->listeners)) { - throw new Doctrine_Connection_Profiler_Exception("Couldn't invoke listener :" . $m); - } // pre-event listener found $a[0]->start(); + if( ! in_array($a[0], $this->events, true)) { $this->events[] = $a[0]; } } else { - if ( ! in_array(strtolower(substr($m, 2)), $this->listeners)) { - throw new Doctrine_Connection_Profiler_Exception("Couldn't invoke listener :" . $m); - } // after-event listener found $a[0]->end(); } @@ -105,11 +100,13 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg * If filtering by query type is enabled, only keep the query if * it was one of the allowed types. */ + /** if ( ! is_null($this->filterTypes)) { if ( ! ($a[0]->getQueryType() & $this->_filterTypes)) { } } + */ } /** diff --git a/lib/Doctrine/Connection/Statement.php b/lib/Doctrine/Connection/Statement.php index 7123e713a..fa2a7b531 100644 --- a/lib/Doctrine/Connection/Statement.php +++ b/lib/Doctrine/Connection/Statement.php @@ -1,4 +1,4 @@ -?php +_adapter = $adapter; + $this->_conn = $conn; $this->_stmt = $stmt; if ($stmt === false) { @@ -48,9 +58,12 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf } } /** + * getConnection + * returns the connection object this statement uses * + * @return Doctrine_Connection */ - public function getDbh() + public function getConnection() { return $this->_adapter; } @@ -200,7 +213,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf */ public function execute($params = null) { - $event = new Doctrine_Db_Event($this, Doctrine_Db_Event::EXECUTE, $this->_stmt->queryString, $params); + $event = new Doctrine_Event($this, Doctrine_Event::EXECUTE, $this->_stmt->queryString, $params); // print $this->_stmt->queryString . print_r($params, true) . "
"; $skip = $this->_adapter->getListener()->onPreExecute($event);