function _drush_sql_expand_and_filter_tables

8.0.x sql.drush.inc _drush_sql_expand_and_filter_tables($tables, $db_tables)
6.x sql.drush.inc _drush_sql_expand_and_filter_tables($tables, $db_tables)
7.x sql.drush.inc _drush_sql_expand_and_filter_tables($tables, $db_tables)
master sql.drush.inc _drush_sql_expand_and_filter_tables($tables, $db_tables)

Given the table names in the input array that may contain wildcards (`*`), expand the table names so that the array returned only contains table names that exist in the database.

Parameters

array $tables: An array of table names where the table names may contain the `*` wildcard character.

array $db_tables: The list of tables present in a database. $db_tables = _drush_sql_get_db_table_list($db_spec, $site_record);

Return value

array An array of tables with non-existant tables removed.

1 call to _drush_sql_expand_and_filter_tables()
drush_sql_get_expanded_table_selection in commands/sql/sql.drush.inc
Get a list of all table names and expand input that may contain wildcards (`*`) if necessary so that the array returned only contains valid table names i.e. actual tables that exist, without a wildcard.

File

commands/sql/sql.drush.inc, line 722
Drush sql commands

Code

function _drush_sql_expand_and_filter_tables($tables, $db_tables) {
  $expanded_tables = drush_sql_expand_wildcard_tables($tables, $db_tables);
  $tables = drush_sql_filter_tables(array_merge($tables, $expanded_tables), $db_tables);
  $tables = array_unique($tables);
  sort($tables);
  return $tables;
}