You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Failed to get current SQL modes. Reason: '"mysql --no-defaults --no-auto-rehash --batch --skip-column-names --execute="SELECT' is not recognized as an internal or external command,
operable program or batch file.
When executing wp db query, than 2 SQL queries are executed internally:
discover SQL mode
execute actual query
The actual query for 2. is build first and calls DB_Command::get_defaults_flag_string()here. This method will remove the $assoc_args['defaults']here. Afterwards when DB_Command:.get_sql_mode_query() is called here, than the defaults is not set anymore in $array_assoc. This results in adding --no-defaults to the query 1.
Describe how other contributors can replicate this bug
Install WP-CLI 2.8.1
Run wp db query "SELECT 1;" --defaults
Interally /usr/bin/env mysql --no-defaults /* snip */ --execute='SELECT @@SESSION.sql_mode' is executed first before /usr/bin/env mysql --execute='SELECT 1;' is called.
Describe what you would expect as the correct outcome
The "discover SQL mode" should also not add --no-defaults when wp db query {sql query} --defaults is executed.
Let us know what environment you are running this on
OS: Windows NT 10.0 build 22621 (Windows 10) AMD64
PHP version: 8.0.19
WP-CLI version: 2.8.1
The text was updated successfully, but these errors were encountered:
Bug Report
Describe the current, buggy behavior
When I run following command:
the query fails with following message:
When executing
wp db query
, than 2 SQL queries are executed internally:The actual query for 2. is build first and calls
DB_Command::get_defaults_flag_string()
here. This method will remove the$assoc_args['defaults']
here. Afterwards whenDB_Command:.get_sql_mode_query()
is called here, than thedefaults
is not set anymore in$array_assoc
. This results in adding--no-defaults
to the query 1.Describe how other contributors can replicate this bug
wp db query "SELECT 1;" --defaults
/usr/bin/env mysql --no-defaults /* snip */ --execute='SELECT @@SESSION.sql_mode'
is executed first before/usr/bin/env mysql --execute='SELECT 1;'
is called.Describe what you would expect as the correct outcome
The "discover SQL mode" should also not add
--no-defaults
whenwp db query {sql query} --defaults
is executed.Let us know what environment you are running this on
The text was updated successfully, but these errors were encountered: