function _drush_sql_get_table_list

3.x _drush_sql_get_table_list($option_name)
4.x _drush_sql_get_table_list($option_name)
5.x _drush_sql_get_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 funciton 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_table_list()


commands/sql/, line 433
Drush sql commands


function _drush_sql_get_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();