-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make "show databases" sql work correctly. #6397
Conversation
Related issue: doctrine/orm#11411
@@ -77,7 +77,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
$forceFetch = $input->getOption('force-fetch'); | |||
assert(is_bool($forceFetch)); | |||
|
|||
if (stripos($sql, 'select') === 0 || $forceFetch) { | |||
$fetchKeywords = ['select', 'show']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
show
is platform specific, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, only mysql work. Should I add some method in Platform class to determine it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to avoid platform-specific code in generic classes. Since SHOW
is a MySQL extension, sniffing for it here is a no-go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I add some method in Platform class to determine it ?
I think it feels kinda weird to have a new method in platform classes for the sole purpose of supporting this very specific use case of a feature that is very questionable and secondary (using the DBAL to run arbitrary SQL input by the user), especially since people can use --force-fetch
and get the correct result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think that we should add another layer of guesswork either. I'd rather like to remove the current special handling of SELECT
, tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New features need to be covered by a test.
@@ -77,7 +77,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
$forceFetch = $input->getOption('force-fetch'); | |||
assert(is_bool($forceFetch)); | |||
|
|||
if (stripos($sql, 'select') === 0 || $forceFetch) { | |||
$fetchKeywords = ['select', 'show']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to avoid platform-specific code in generic classes. Since SHOW
is a MySQL extension, sniffing for it here is a no-go.
Close now, I will continue on it when I have more time. |
Related issue: doctrine/orm#11411
Summary