In order to debug my code I would like to see the explicit sql query that is executed.
I create the query with createQueryBuilder
, and the most explicit thing I achieved is having the raw query using:
$qb->getQuery()->getSQL();
The problem is that instead of parameters I see the holders (?
).
I found some solutions on the web but they are for 1.3 and 1.4, nothing for Symfony-2.
Ideas? Thanks!
On the Data tab, in the Connections group, click Properties. In the Connection Properties dialog box, click the Definition tab, and then click Parameters. In the Parameters dialog box, in the Parameter name list, click the parameter that you want to change.
Query Parameter Example For example, in `https://www.google.com/search?q=abstract%20api`, we have a standard Google search, with the user input `abstract%20api` being passed as a variable via the query parameter `q=`. We can pass multiple variables with the `&` symbol separating parameters, forming a query string.
To view the SQL code for an Access query, open the query in query design view. Then click the “View” drop-down button in the “Results” button group on the “Design” tab of the “Query Tools” contextual tab in the Ribbon. From the drop-down menu of choices that appears, select the “SQL View” command.
You can access the parameters used by the placeholders using $query->getParameters()
, so you could debug your query using:
$query = $qb->getQuery();
print_r(array(
'sql' => $query->getSQL(),
'parameters' => $query->getParameters(),
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With