Skip to content

Commit

Permalink
Merge pull request #802 from stof/fix_explain
Browse files Browse the repository at this point in the history
Fix explaining queries
  • Loading branch information
kimhemsoe committed Apr 20, 2018
2 parents 703fad3 + 6de4d03 commit fbb8a34
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Controller/ProfilerController.php
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\VarDumper\Cloner\Data;

/**
* ProfilerController.
Expand Down Expand Up @@ -77,14 +78,27 @@ private function explainSQLServerPlatform(Connection $connection, $query)
} else {
$sql = 'SET SHOWPLAN_TEXT ON; GO; SET NOEXEC ON; ' . $query['sql'] . '; SET NOEXEC OFF; GO; SET SHOWPLAN_TEXT OFF;';
}
$stmt = $connection->executeQuery($sql, $query['params'], $query['types']);

$params = $query['params'];

if ($params instanceof Data) {
$params = $params->getValue(true);
}

$stmt = $connection->executeQuery($sql, $params, $query['types']);
$stmt->nextRowset();
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
}

private function explainOtherPlatform(Connection $connection, $query)
{
return $connection->executeQuery('EXPLAIN ' . $query['sql'], $query['params'], $query['types'])
$params = $query['params'];

if ($params instanceof Data) {
$params = $params->getValue(true);
}

return $connection->executeQuery('EXPLAIN ' . $query['sql'], $params, $query['types'])
->fetchAll(\PDO::FETCH_ASSOC);
}
}

0 comments on commit fbb8a34

Please sign in to comment.