Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the sql statement parameters if they exist #513

Closed

Conversation

mikeSimonson
Copy link
Contributor

No description provided.

@mikeSimonson mikeSimonson self-assigned this Mar 7, 2017
@mikeSimonson mikeSimonson modified the milestones: 1.5, 1.6 Mar 7, 2017
@@ -407,7 +407,8 @@ private function executeRegisteredSql($dryRun = false, $timeAllQueries = false)
$this->outputWriter->write(' <comment>-></comment> ' . $query);
$this->connection->executeQuery($query);
} else {
$this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query));
$parameters = implode(', ', $this->params[$key]);
$this->outputWriter->write(sprintf(' <comment>-</comment> %s (%s)', $query, $parameters));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole bit (including the if/else check for the params) could be replaced with $this->outputSqlQuery($key, $query).

I added that in #477 -- uses the doctrine types system to convert the params into something printable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better indeed.

@mikeSimonson mikeSimonson force-pushed the show-sql-stmt-params branch from 1f9e1ed to eff7d50 Compare March 7, 2017 16:23
@mikeSimonson
Copy link
Contributor Author

@chrisguitarguy Thanks for the review

$this->connection->executeQuery($query);
} else {
$this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query));
$this->outputSqlQuery($key, $query);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calls to $this->outputSqlQuery could be moved above the if/else block here.

@mikeSimonson mikeSimonson force-pushed the show-sql-stmt-params branch from eff7d50 to 3ebe6cd Compare March 7, 2017 20:38
@@ -403,11 +403,10 @@ private function executeRegisteredSql($dryRun = false, $timeAllQueries = false)
foreach ($this->sql as $key => $query) {
$queryStart = microtime(true);

$this->outputSqlQuery($key, $query);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably break migrations that use \PDO::* or \Doctrine\DBAL\Connection::* parameter types (see #528)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikeSimonson is this a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been fixed by #560. I will try to add a test for that specific case.

@alcaeus alcaeus modified the milestones: 1.6, 1.7 Nov 7, 2017
@jwage jwage modified the milestones: 1.7, 2.0 May 5, 2018
@jwage
Copy link
Member

jwage commented May 16, 2018

This is implemented and covered by tests now.

@jwage jwage closed this May 16, 2018
@jwage jwage removed this from the 2.0 milestone May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants