Skip to content

Commit

Permalink
Table: update approach inside exists().
Browse files Browse the repository at this point in the history
This change improves compatibility with temporary tables used in PHPUnit test suites.

Fixes #104.
  • Loading branch information
JJJ committed May 28, 2021
1 parent 0d168fb commit 3ee662b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions table.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,8 @@ public function exists() {
}

// Query statement
$query = "SHOW TABLES LIKE %s";
$like = $db->esc_like( $this->table_name );
$prepared = $db->prepare( $query, $like );
$result = $db->get_var( $prepared );
$query = "SHOW CREATE TABLE {$this->table_name}";
$result = $db->query( $query );

// Does the table exist?
return $this->is_success( $result );
Expand Down

0 comments on commit 3ee662b

Please sign in to comment.