add database.profile config option.
This commit is contained in:
parent
b29f8a88fe
commit
36834c1118
|
|
@ -2,6 +2,20 @@
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Query Logging
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By default, the SQL, bindings, and execution time are logged in an array
|
||||||
|
| for you to review. They can be retrieved via the DB::profile() method.
|
||||||
|
| However, in some situations, you may want to disable logging for
|
||||||
|
| ultra high-volume database work. You can do so here.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'profile' => true,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Default Database Connection
|
| Default Database Connection
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php namespace Laravel\Database; use PDO, PDOStatement, Laravel\Event;
|
<?php namespace Laravel\Database; use PDO, PDOStatement, Laravel\Config, Laravel\Event;
|
||||||
|
|
||||||
class Connection {
|
class Connection {
|
||||||
|
|
||||||
|
|
@ -222,7 +222,10 @@ protected function execute($sql, $bindings = array())
|
||||||
// Once we have execute the query, we log the SQL, bindings, and
|
// Once we have execute the query, we log the SQL, bindings, and
|
||||||
// execution time in a static array that is accessed by all of
|
// execution time in a static array that is accessed by all of
|
||||||
// the connections used by the application.
|
// the connections used by the application.
|
||||||
|
if (Config::get('database.profile'))
|
||||||
|
{
|
||||||
$this->log($sql, $bindings, $time);
|
$this->log($sql, $bindings, $time);
|
||||||
|
}
|
||||||
|
|
||||||
return array($statement, $result);
|
return array($statement, $result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue