function _drush_sql_get_raw_table_list

8.0.x _drush_sql_get_raw_table_list($option_name)
6.x _drush_sql_get_raw_table_list($option_name)
7.x _drush_sql_get_raw_table_list($option_name)
master _drush_sql_get_raw_table_list($option_name)

Consult the specified options and return the list of tables specified.

@returns array Returns an array of tables based on the first option found, or an empty array if there were no matches.


option_name: The option name to check: skip-tables, structure-tables or tables. This function will check both *-key and *-list, and, in the case of sql-sync, will also check target-* and source-*, to see if an alias set one of these options.

1 call to _drush_sql_get_raw_table_list()
drush_sql_get_table_selection in commands/sql/
Construct an array that places table names in appropriate buckets based on whether the table is to be skipped, included for structure only, or have structure and data dumped. The keys of the array are:


commands/sql/, line 383
Drush sql commands


function _drush_sql_get_raw_table_list($option_name) {
  foreach (array(
    '' => 'cli',
    'target-,,source-' => NULL,
  ) as $prefix_list => $context) {
    foreach (explode(',', $prefix_list) as $prefix) {
      $key_list = drush_get_option($prefix . $option_name . '-key', NULL, $context);
      foreach (explode(',', $key_list) as $key) {
        $all_tables = drush_get_option($option_name, array());
        if (array_key_exists($key, $all_tables)) {
          return $all_tables[$key];
        if ($option_name != 'tables') {
          $all_tables = drush_get_option('tables', array());
          if (array_key_exists($key, $all_tables)) {
            return $all_tables[$key];
      $table_list = drush_get_option($prefix . $option_name . '-list', NULL, $context);
      if (isset($table_list)) {
        return empty($table_list) ? array() : explode(',', $table_list);

  return array();