public function SqlBase::query_prefix

8.0.x SqlBase.php public SqlBase::query_prefix($query)
7.x SqlBase.php public SqlBase::query_prefix($query)
master SqlBase.php public SqlBase::query_prefix($query)
1 call to SqlBase::query_prefix()
SqlBase::query in lib/Drush/Sql/SqlBase.php
Execute a SQL query.

File

lib/Drush/Sql/SqlBase.php, line 197

Namespace

Drush\Sql

Class

SqlBase

Code

public function query_prefix($query) {
  // Inject table prefixes as needed.
  if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_DATABASE)) {
    // Enable prefix processing which can be dangerous so off by default. See http://drupal.org/node/1219850.
    if (drush_get_option('db-prefix')) {
      if (drush_drupal_major_version() >= 7) {
        $query = Database::getConnection()->prefixTables($query);
      }
      else {
        $query = db_prefix_tables($query);
      }
    }
  }
  return $query;
}