Skip to content

Commit

Permalink
Append table alias
Browse files Browse the repository at this point in the history
  • Loading branch information
luismulinari committed Oct 3, 2023
1 parent dfe9d50 commit 6310411
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/db-multiple-datasets-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function query( $query ) {
$regex = "/(?:FROM|JOIN|UPDATE|INTO|,)\s+`?($wpdb->base_prefix(\d+)?_?(?:\w+)+?)`?/i";

$query = preg_replace_callback( $regex, function ($match) use ( $wpdb ) {
return str_replace( $match[1], get_dataset_for_table( $wpdb->base_prefix, $match[1] ) . '.' . $match[1], $match[0] );
},$query);
return str_replace( $match[1], get_dataset_for_table( $wpdb->base_prefix, $match[1] ) . '.' . $match[1] . ' ' . $match[1], $match[0] );
}, $query );

$query .= ' ' . MULTIPLE_DATASET_QUERY_ANNOTATION;

Expand Down

0 comments on commit 6310411

Please sign in to comment.