Automattic\WooCommerce\Database\Migrations
TableMigrator::db_query
Run $wpdb->query and add the error, if any, to the errors list.
Method of the class: TableMigrator{}
No Hooks.
Returns
Mixed. Whatever $wpdb->query returns.
Usage
// protected - for code of main (parent) or child class $result = $this->db_query( $query );
- $query(string) (required)
- The SQL query to run.
TableMigrator::db_query() TableMigrator::db query code WC 10.5.0
protected function db_query( string $query ) {
$wpdb = WC()->get_global( 'wpdb' );
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$result = $wpdb->query( $query );
if ( '' !== $wpdb->last_error ) {
$this->add_error( $wpdb->last_error );
}
return $result;
}