function drush_sql_query

8.0.x sql.drush.inc drush_sql_query($query = NULL)
6.x sql.drush.inc drush_sql_query($query = NULL)
7.x sql.drush.inc drush_sql_query($query = NULL)
3.x sql.drush.inc drush_sql_query($query)
4.x sql.drush.inc drush_sql_query($query, $filename = NULL)
5.x sql.drush.inc drush_sql_query($query = NULL)
master sql.drush.inc drush_sql_query($query = NULL)

Command callback. Executes the given SQL query on the Drupal database.

1 call to drush_sql_query()
drush_sql_sanitize in commands/sql/sql.drush.inc
Command callback. Run's the sanitization operations on the current database.

File

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

Code

function drush_sql_query($query = NULL) {
  drush_sql_bootstrap_further();
  $filename = drush_get_option('file', NULL);
  // Enable prefix processing when db-prefix option is used.
  if (drush_get_option('db-prefix')) {
    drush_bootstrap_max(DRUSH_BOOTSTRAP_DRUPAL_DATABASE);
  }
  $result = _drush_sql_query($query, drush_get_option('db-spec'), $filename);
  if (!$result) {
    return drush_set_error('DRUSH_SQL_NO_QUERY', dt('Query failed.'));
  }
  elseif (drush_get_option('file-delete')) {
    drush_op('drush_delete_dir', $filename);
  }
  return TRUE;
}