Skip to content

Conversation

@TerrenceSullivanSC
Copy link

@TerrenceSullivanSC TerrenceSullivanSC commented Mar 1, 2025

Allow defaults to be used in querying the SQL mode

Fixes #278

@TerrenceSullivanSC TerrenceSullivanSC requested a review from a team as a code owner March 1, 2025 19:04
@swissspidy

This comment was marked as resolved.

@swissspidy swissspidy changed the title Only unset defaults before running command. Allow defaults to be used… Only unset defaults before running command. Mar 2, 2025
@kraftner

This comment was marked as resolved.

@swissspidy swissspidy closed this Oct 14, 2025
@swissspidy swissspidy reopened this Oct 14, 2025
@swissspidy

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy requested a review from Copilot January 20, 2026 11:24
@swissspidy
Copy link
Member

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the handling of the --defaults flag by centralizing its unsetting to the run method. This ensures that the flag is correctly processed by get_defaults_flag_string to determine whether --no-defaults should be added to the command, and then removed before being passed to the underlying MySQL command execution. This improves the maintainability and correctness of argument handling, especially for commands that query SQL modes, as the defaults flag is now available for evaluation until the final command execution step. The changes are well-implemented and align with the stated objective.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where database queries fail when using TLS/SSL connections with non-standard certificate authorities. The issue occurred because the --defaults flag was being removed too early in the execution flow, preventing MySQL client configuration files (which may contain TLS settings) from being loaded when querying SQL modes.

Changes:

  • Move the removal of the defaults key from get_defaults_flag_string() to the run() method, allowing MySQL defaults files to be used when querying SQL modes while still preventing the invalid argument from being passed to MySQL

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 2099 to 2102
if ( true === Utils\get_flag_value( $assoc_args, 'defaults' ) ) {
$flag_string = '';
}

unset( $assoc_args['defaults'] );

}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

Since get_defaults_flag_string() no longer removes the 'defaults' key from the array, consider updating the method signature from protected function get_defaults_flag_string( &$assoc_args ) to protected function get_defaults_flag_string( $assoc_args ) to remove the unnecessary by-reference parameter.

Copilot uses AI. Check for mistakes.
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.

get_current_sql_modes() fails if TLS is being used.

4 participants