function drush_sql_filter_tables

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

Filters tables.

Parameters

array $tables: An array of table names to filter.

array $db_tables: An array with all the existing table names in the current database.

Return value

An array with only valid table names (i.e. all of which actually exist in the database).

2 calls to drush_sql_filter_tables()
WildcardUnitCase::testFilterTables in tests/expandWildcardTablesUnitTest.php
Tests drush_sql_filter_tables().
_drush_sql_expand_and_filter_tables in commands/sql/sql.drush.inc
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.

File

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

Code

function drush_sql_filter_tables($tables, $db_tables) {
  // Ensure all the tables actually exist in the database.
  foreach ($tables as $k => $table) {
    if (!in_array($table, $db_tables)) {
      unset($tables[$k]);
    }
  }

  return $tables;
}