/**
* Check if a table exists.
*
* @param $table
* The name of the table in drupal (no prefixing).
*
* @return bool
* TRUE if the given table exists, otherwise FALSE.
*/
public function tableExists($table) { $condition =
$this->
buildTableNameCondition($table);
$condition->
compile($this->connection,
$this);
// Normally, we would heartily discourage the use of string
// concatenation for conditionals like this however, we
// couldn't use \Drupal::database()->select() here because it would prefix
// information_schema.tables and the query would fail.
// Don't use {} around information_schema.tables table.
return (bool) $this->connection->
query("SELECT 1 FROM information_schema.tables WHERE " .
(string) $condition,
$condition->
arguments())->
fetchField();
} /**
* Finds all tables that are like the specified base table name.
*
* @param string $table_expression
* A case-insensitive pattern against which table names are compared. Both
* '_' and '%' are treated like wildcards in MySQL 'LIKE' expressions, where
* '_' matches any single character and '%' matches an arbitrary number of
* characters (including zero characters). So 'foo%bar' matches table names
* like 'foobar', 'fooXBar', 'fooXBaR', or 'fooXxBar'; whereas 'foo_bar'
* matches 'fooXBar' and 'fooXBaR' but not 'fooBar' or 'fooXxxBar'.
*
* @return array
* Both the keys and the values are the matching tables.
*/