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

Make "show databases" sql work correctly. #6397

Closed
wants to merge 1 commit into from

Conversation

ywisax
Copy link

@ywisax ywisax commented May 15, 2024

Related issue: doctrine/orm#11411

Q A
Type improvement
Fixed issues

Summary

@@ -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'];
Copy link
Member

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?

Copy link
Author

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 ?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

@derrabus derrabus changed the base branch from 4.0.x to 4.1.x May 16, 2024 06:19
@derrabus derrabus changed the base branch from 4.1.x to 4.0.x May 16, 2024 06:19
@derrabus derrabus changed the base branch from 4.0.x to 4.1.x May 16, 2024 06:44
Copy link
Member

@derrabus derrabus left a 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'];
Copy link
Member

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.

@ywisax
Copy link
Author

ywisax commented May 16, 2024

Close now, I will continue on it when I have more time.

@ywisax ywisax closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants