Automattic\WooCommerce\Internal\Utilities

DatabaseUtil::get_missing_tables()publicWC 1.0

Given a set of table creation SQL statements, check which of the tables are currently missing in the database.

Method of the class: DatabaseUtil{}

No Hooks.

Return

Array. An array containing the names of the tables that currently don't exist in the database.

Usage

$DatabaseUtil = new DatabaseUtil();
$DatabaseUtil->get_missing_tables( $creation_queries ): array;
$creation_queries(string) (required)
The SQL queries to execute ("CREATE TABLE" statements, same format as for dbDelta).

DatabaseUtil::get_missing_tables() code WC 8.7.0

public function get_missing_tables( string $creation_queries ): array {
	global $wpdb;
	$suppress_errors = $wpdb->suppress_errors( true );
	$dbdelta_output  = $this->dbdelta( $creation_queries, false );
	$wpdb->suppress_errors( $suppress_errors );
	$parsed_output = $this->parse_dbdelta_output( $dbdelta_output );
	return $parsed_output['created_tables'];
}