add limit to logger explosion

This limit is required to display complete query with e.g. "array" type in it.
This commit is contained in:
Toni Uebernickel 2012-03-26 16:52:33 +02:00
parent cd56d09012
commit dd4d46a4c7
2 changed files with 12 additions and 5 deletions

View File

@ -116,7 +116,7 @@ class PropelDataCollector extends DataCollector
$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]);

View File

@ -51,7 +51,8 @@ class PropelDataCollectorTest extends Propel1TestCase
{
$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);
@ -69,10 +70,16 @@ class PropelDataCollectorTest extends Propel1TestCase
'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)