This commit is contained in:
parent
ad3f5bb6ff
commit
fbc1d9c3ec
@ -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)) {
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
?php
|
||||
<?php
|
||||
/*
|
||||
* $Id: Statement.php 1532 2007-05-31 17:45:07Z zYne $
|
||||
*
|
||||
@ -32,15 +32,25 @@ Doctrine::autoload('Doctrine_Adapter_Statement_Interface');
|
||||
*/
|
||||
class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interface
|
||||
{
|
||||
protected $_adapter;
|
||||
/**
|
||||
* @var Doctrine_Connection $conn Doctrine_Connection object, every connection
|
||||
* statement holds an instance of Doctrine_Connection
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
protected $_stmt;
|
||||
|
||||
protected $_executed = false;
|
||||
|
||||
public function __construct($adapter, $stmt)
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param Doctrine_Connection $conn Doctrine_Connection object, every connection
|
||||
* statement holds an instance of Doctrine_Connection
|
||||
* @param mixed $stmt
|
||||
*/
|
||||
public function __construct(Doctrine_Connection $conn, $stmt)
|
||||
{
|
||||
$this->_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) . "<br>";
|
||||
$skip = $this->_adapter->getListener()->onPreExecute($event);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user