You are here

public function MigrateConnectionQuery::getString in Migrate 7.2

Return a string representing the source query.

This is copied from devel module's dpq() function.

Parameters

bool $prefix: If the tables should be prefixed. If FALSE will return tables names in the query like {tablename}.

Return value

string The SQL query.

File

plugins/sources/sql.inc, line 490
Define a MigrateSource for importing from Drupal connections.

Class

MigrateConnectionQuery
Query extender for retrieving the connection used on the query.

Code

public function getString($prefix = TRUE) {
  $query = $this;
  if (method_exists($this, 'preExecute')) {
    $query
      ->preExecute();
  }
  $sql = (string) $this;
  $quoted = array();
  foreach ((array) $this
    ->arguments() as $key => $val) {
    $quoted[$key] = $this->connection
      ->quote($val);
  }
  $sql = strtr($sql, $quoted);
  if ($prefix) {
    $sql = $this->connection
      ->prefixTables($sql);
  }
  return $sql;
}