function drush_sql_get_expanded_table_selection

6.x drush_sql_get_expanded_table_selection($db_spec, $site_record = NULL)

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.


$db_spec: For D5/D6, a $db_url. For D7+, a target in the default DB connection.

$site_record: Necessary for remote database.

Return value

array An array of tables with each table name in the appropriate element of the array.

3 calls to drush_sql_get_expanded_table_selection()
drush_archive_dump in commands/core/
Command callback. Generate site archive file.
drush_sql_dump in commands/sql/
Build a mysqldump/pg_dump/sqlite statement.
drush_sql_sync in commands/sql/


commands/sql/, line 449
Drush sql commands


function drush_sql_get_expanded_table_selection($db_spec, $site_record = NULL) {
  $table_selection = drush_sql_get_table_selection();
  // Get the existing table names in the specified database.
  $db_tables = _drush_sql_get_db_table_list($db_spec, $site_record);
  if (isset($table_selection['skip'])) {
    $table_selection['skip'] = _drush_sql_expand_and_filter_tables($table_selection['skip'], $db_tables);
  if (isset($table_selection['structure'])) {
    $table_selection['structure'] = _drush_sql_expand_and_filter_tables($table_selection['structure'], $db_tables);
  if (isset($table_selection['tables'])) {
    $table_selection['tables'] = _drush_sql_expand_and_filter_tables($table_selection['tables'], $db_tables);
  return $table_selection;