Opened 6 years ago
#49363 new defect (bug)
wpdb::query() does not detect LOAD DATA as an insert statement type
| Reported by: | lev0 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Database | Version: | 5.3.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
The regular expression used to choose what return type a query should have does not include LOAD DATA. A query beginning with these tokens thus incorrectly returns 0 for the number of affected rows. The following patch would correct the issue:
-
wp-includes/wp-db.php
a b 1973 1973 1974 1974 if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) { 1975 1975 $return_val = $this->result; 1976 } elseif ( preg_match( '/^\s*(insert|delete|update|replace )\s/i', $query ) ) {1976 } elseif ( preg_match( '/^\s*(insert|delete|update|replace|load\s+data)\s/i', $query ) ) { 1977 1977 if ( $this->use_mysqli ) { 1978 1978 $this->rows_affected = mysqli_affected_rows( $this->dbh ); 1979 1979 } else {
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)