Commit 36834c11 authored by Taylor Otwell's avatar Taylor Otwell

add database.profile config option.

parent b29f8a88
...@@ -2,6 +2,20 @@ ...@@ -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
......
<?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 @@ class Connection { ...@@ -222,7 +222,10 @@ class Connection {
// 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.
$this->log($sql, $bindings, $time); if (Config::get('database.profile'))
{
$this->log($sql, $bindings, $time);
}
return array($statement, $result); return array($statement, $result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment