function drush_sql_build_exec

6.x sql.drush.inc drush_sql_build_exec($db_spec, $filepath)
4.x sql.drush.inc drush_sql_build_exec($db_spec, $filepath)
5.x sql.drush.inc drush_sql_build_exec($db_spec, $filepath)
2 calls to drush_sql_build_exec()

File

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

Code

function drush_sql_build_exec($db_spec, $filepath) {
  $scheme = _drush_sql_get_scheme($db_spec);
  switch ($scheme) {
    case 'mysql':
      $exec = 'mysql';
      $exec .= _drush_sql_get_credentials($db_spec);
      $exec .= ' ' . drush_get_option('extra');
      $exec .= " < $filepath";

      break;
    case 'pgsql':
      $exec = 'psql -q ';
      $exec .= _drush_sql_get_credentials($db_spec);
      $exec .= ' ' . (drush_get_option('extra') ? drush_get_option('extra') : "--no-align --field-separator='\t' --pset footer=off");
      $exec .= " --file $filepath";
      break;
    case 'sqlite':
      $exec = 'sqlite3';
      $exec .= ' ' . drush_get_option('extra');
      $exec .= _drush_sql_get_credentials($db_spec);
      $exec .= " < $filepath";
      break;
  }
  return $exec;
}