Automattic\WooCommerce\Database\Migrations

TableMigrator::db_query()protectedWC 1.0

Run $wpdb->query and add the error, if any, to the errors list.

Method of the class: TableMigrator{}

No Hooks.

Return

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() code WC 8.7.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;
}