Skip to content

Commit

Permalink
add limit to logger explosion
Browse files Browse the repository at this point in the history
This limit is required to display complete query with e.g. "array" type in it.
  • Loading branch information
havvg committed Mar 26, 2012
1 parent cd56d09 commit dd4d46a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Expand Up @@ -116,7 +116,7 @@ private function buildQueries()
$innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');

foreach ($this->logger->getQueries() as $q) {
$parts = explode($outerGlue, $q);
$parts = explode($outerGlue, $q, 4);

$times = explode($innerGlue, $parts[0]);
$con = explode($innerGlue, $parts[2]);
Expand Down
Expand Up @@ -51,7 +51,8 @@ public function testCollectWithMultipleData()
{
$queries = array(
"time: 0.000 sec | mem: 1.4 MB | connection: default | SET NAMES 'utf8'",
"time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12"
"time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
"time: 0.012 sec | mem: 2.4 MB | connection: default | INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
);

$c = $this->createCollector($queries);
Expand All @@ -69,10 +70,16 @@ public function testCollectWithMultipleData()
'time' => '0.012 sec',
'connection'=> 'default',
'memory' => '2.4 MB'
)
),
array(
'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
'time' => '0.012 sec',
'connection'=> 'default',
'memory' => '2.4 MB'
),
), $c->getQueries());
$this->assertEquals(2, $c->getQueryCount());
$this->assertEquals(0.012, $c->getTime());
$this->assertEquals(3, $c->getQueryCount());
$this->assertEquals(0.024, $c->getTime());
}

private function createCollector($queries)
Expand Down

0 comments on commit dd4d46a

Please sign in to comment.