Skip to content

Commit

Permalink
Merge pull request #2774 from woocommerce/tweak/500-query-and-table
Browse files Browse the repository at this point in the history
Adjust some query and table functions
  • Loading branch information
mikkamp authored Jan 21, 2025
2 parents 2faf213 + 2f2c112 commit 6e15a75
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions src/DB/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,6 @@ protected function build_query( bool $get_count = false ): string {
}

if ( ! $get_count ) {
if ( empty( $this->groupby ) ) {
$pieces[] = "GROUP BY `{$this->table->get_name()}`.`{$this->table->get_primary_column()}`";
}

if ( $this->orderby ) {
$pieces[] = 'ORDER BY ' . implode( ', ', $this->orderby );
}
Expand Down
2 changes: 1 addition & 1 deletion src/DB/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function install(): void {
*/
public function exists(): bool {
$result = $this->wpdb->get_var(
"SHOW TABLES LIKE '{$this->get_sql_safe_name()}'" // phpcs:ignore WordPress.DB.PreparedSQL
"SHOW TABLES LIKE '{$this->wpdb->esc_like( $this->get_name() )}'" // phpcs:ignore WordPress.DB.PreparedSQL
);

return $result === $this->get_name();
Expand Down

0 comments on commit 6e15a75

Please sign in to comment.