add database.profile config option.
This commit is contained in:
@@ -2,6 +2,20 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -222,7 +222,10 @@ class Connection {
|
||||
// Once we have execute the query, we log the SQL, bindings, and
|
||||
// execution time in a static array that is accessed by all of
|
||||
// the connections used by the application.
|
||||
$this->log($sql, $bindings, $time);
|
||||
if (Config::get('database.profile'))
|
||||
{
|
||||
$this->log($sql, $bindings, $time);
|
||||
}
|
||||
|
||||
return array($statement, $result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user