Created
March 22, 2014 03:17
-
-
Save ranacseruet/9700579 to your computer and use it in GitHub Desktop.
Custom CodeIgnite Profiler Class For Doctrine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Doctrine\DBAL\Logging; | |
class CIProfiler implements SQLLogger | |
{ | |
public $start = null; | |
private $ci; | |
public function __construct() | |
{ | |
$this->ci =& get_instance(); | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function startQuery($sql, array $params = null, array $types = null) | |
{ | |
$this->start = microtime(true); | |
$this->ci->db->queries[] = "/* doctrine */ \n".$sql; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
public function stopQuery() | |
{ | |
$this->ci->db->query_times[] = microtime(true) - $this->start; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment