Updated Database_Query to include the SQL compiliation as part of the benchmark time/memory usage

This commit is contained in:
Woody Gilk 2009-06-22 15:15:38 -05:00
parent 8b93b497d5
commit b5a198a825

View file

@ -144,15 +144,15 @@ class Database_Query {
$db = Database::instance($db); $db = Database::instance($db);
} }
// Compile the SQL for this query
$sql = $this->compile($db);
if ( ! empty($this->_config['profiling'])) if ( ! empty($this->_config['profiling']))
{ {
// Start profiling this query // Start profiling this query
$benchmark = Profiler::start('Query ('.(string) $db.')', $sql); $benchmark = Profiler::start('Query ('.(string) $db.')');
} }
// Compile the SQL for this query
$sql = $this->compile($db);
// Load the result // Load the result
$result = $db->query($this->_type, $sql); $result = $db->query($this->_type, $sql);
@ -160,6 +160,9 @@ class Database_Query {
{ {
// Stop profiling // Stop profiling
Profiler::stop($benchmark); Profiler::stop($benchmark);
// Add the SQL as the benchmark name
Profiler::name($benchmark, $sql);
} }
return $result; return $result;