By default database errors are suppressed, with a simple
call to this function they can be enabled.
public suppress_errors ( boolean $suppress = true ) : boolean | ||
$suppress | boolean | Optional. New value. Defaults to true. |
return | boolean | Old value |
/** * Fetches rows from database. * * @since 1.0.0 * * @access public * @param string $table The table name. * @param array|string $columns The array of columns to select. * @param array $criteria The array of conditions. * @return array The array of fetched rows. */ public function grabFromDatabase($table, $columns, $criteria = array()) { $query = $this->_prepareQuery($table, $columns, $criteria); $this->debugSection('Query', $query); $suppress_errors = $this->_wpdb->suppress_errors(true); $results = $this->_wpdb->get_results($query); $this->_wpdb->suppress_errors($suppress_errors); if (!empty($this->_wpdb->last_error)) { $this->fail('Database error: ' . $this->_wpdb->last_error); return; } return $results; }