Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions features/db-query.feature
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,4 @@ Feature: Query the database with WordPress' MySQL config
When I try `wp db query --no-defaults --debug`
Then STDERR should match #Debug \(db\): Running shell command: /usr/bin/env (mysql|mariadb) --no-defaults --no-auto-rehash#

Scenario: SQL modes do not include any of the modes incompatible with WordPress
Given a WP install

When I try `wp db query 'SELECT @@SESSION.sql_mode;' --debug`
Then STDOUT should not contain:
"""
NO_ZERO_DATE
"""
And STDOUT should not contain:
"""
ONLY_FULL_GROUP_BY
"""
And STDOUT should not contain:
"""
STRICT_TRANS_TABLES
"""
And STDOUT should not contain:
"""
STRICT_ALL_TABLES
"""
And STDOUT should not contain:
"""
TRADITIONAL
"""
And STDOUT should not contain:
"""
ANSI
"""
5 changes: 0 additions & 5 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,6 @@ public function query( $args, $assoc_args ) {
$assoc_args['execute'] = $args[0];
}

if ( isset( $assoc_args['execute'] ) ) {
// Ensure that the SQL mode is compatible with WPDB.
$assoc_args['execute'] = $this->get_sql_mode_query( $assoc_args ) . $assoc_args['execute'];
}

$is_row_modifying_query = isset( $assoc_args['execute'] ) && preg_match( '/\b(UPDATE|DELETE|INSERT|REPLACE|LOAD DATA)\b/i', $assoc_args['execute'] );

if ( $is_row_modifying_query ) {
Expand Down
Loading