You are here

class MigrateConnectionQuery in Migrate 7.2

Query extender for retrieving the connection used on the query.

Hierarchy

Expanded class hierarchy of MigrateConnectionQuery

1 string reference to 'MigrateConnectionQuery'
MigrateSourceSQL::__toString in plugins/sources/sql.inc
Return a string representing the source query.

File

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

View source
class MigrateConnectionQuery extends SelectQueryExtender {
  public function __construct(SelectQueryInterface $query, DatabaseConnection $connection) {
    parent::__construct($query, $connection);

    // Add the connection as metadata if anything else wants to access it.
    $query
      ->addMetaData('connection', $connection);
  }

  /**
   * Return a string representing the source query.
   *
   * This is copied from devel module's dpq() function.
   *
   * @param bool $prefix
   *   If the tables should be prefixed. If FALSE will return tables names in
   *   the query like {tablename}.
   *
   * @return string
   *   The SQL query.
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateConnectionQuery::getString public function Return a string representing the source query.
MigrateConnectionQuery::__construct public function Overrides SelectQueryExtender::__construct
SelectQueryExtender::$connection protected property The connection object on which to run this query.
SelectQueryExtender::$placeholder protected property The placeholder counter.
SelectQueryExtender::$query protected property The SelectQuery object we are extending/decorating.
SelectQueryExtender::$uniqueIdentifier protected property A unique identifier for this query object.
SelectQueryExtender::addExpression public function Adds an expression to the list of "fields" to be SELECTed. Overrides SelectQueryInterface::addExpression
SelectQueryExtender::addField public function Adds a field to the list to be SELECTed. Overrides SelectQueryInterface::addField
SelectQueryExtender::addJoin public function Join against another table in the database. Overrides SelectQueryInterface::addJoin
SelectQueryExtender::addMetaData public function Adds additional metadata to the query. Overrides QueryAlterableInterface::addMetaData
SelectQueryExtender::addTag public function Adds a tag to a query. Overrides QueryAlterableInterface::addTag
SelectQueryExtender::arguments public function Gets a complete list of all values to insert into the prepared statement. Overrides QueryConditionInterface::arguments
SelectQueryExtender::compile public function Compiles the saved conditions for later retrieval. Overrides QueryConditionInterface::compile
SelectQueryExtender::compiled public function Check whether a condition has been previously compiled. Overrides QueryConditionInterface::compiled
SelectQueryExtender::condition public function Helper function: builds the most common conditional clauses. Overrides QueryConditionInterface::condition
SelectQueryExtender::conditions public function Gets a complete list of all conditions in this conditional clause. Overrides QueryConditionInterface::conditions
SelectQueryExtender::countQuery public function Get the equivalent COUNT query of this query as a new query object. Overrides SelectQueryInterface::countQuery 1
SelectQueryExtender::distinct public function Sets this query to be DISTINCT. Overrides SelectQueryInterface::distinct
SelectQueryExtender::execute public function 2
SelectQueryExtender::exists public function Sets a condition that the specified subquery returns values. Overrides QueryConditionInterface::exists
SelectQueryExtender::extend public function Enhance this object by wrapping it in an extender object. Overrides QueryExtendableInterface::extend
SelectQueryExtender::fields public function Add multiple fields from the same table to be SELECTed. Overrides SelectQueryInterface::fields
SelectQueryExtender::forUpdate public function Add FOR UPDATE to the query. Overrides SelectQueryInterface::forUpdate
SelectQueryExtender::getArguments public function Compiles and returns an associative array of the arguments for this prepared statement. Overrides SelectQueryInterface::getArguments
SelectQueryExtender::getExpressions public function Returns a reference to the expressions array for this query. Overrides SelectQueryInterface::getExpressions
SelectQueryExtender::getFields public function Returns a reference to the fields array for this query. Overrides SelectQueryInterface::getFields
SelectQueryExtender::getGroupBy public function Returns a reference to the group-by array for this query. Overrides SelectQueryInterface::getGroupBy
SelectQueryExtender::getMetaData public function Retrieves a given piece of metadata. Overrides QueryAlterableInterface::getMetaData
SelectQueryExtender::getOrderBy public function Returns a reference to the order by array for this query. Overrides SelectQueryInterface::getOrderBy
SelectQueryExtender::getTables public function Returns a reference to the tables array for this query. Overrides SelectQueryInterface::getTables
SelectQueryExtender::getUnion public function Returns a reference to the union queries for this query. This include queries for UNION, UNION ALL, and UNION DISTINCT. Overrides SelectQueryInterface::getUnion
SelectQueryExtender::groupBy public function Groups the result set by the specified field. Overrides SelectQueryInterface::groupBy
SelectQueryExtender::hasAllTags public function Determines if a given query has all specified tags. Overrides QueryAlterableInterface::hasAllTags
SelectQueryExtender::hasAnyTag public function Determines if a given query has any specified tag. Overrides QueryAlterableInterface::hasAnyTag
SelectQueryExtender::hasTag public function Determines if a given query has a given tag. Overrides QueryAlterableInterface::hasTag
SelectQueryExtender::having public function
SelectQueryExtender::havingArguments public function
SelectQueryExtender::havingCompile public function
SelectQueryExtender::havingCondition public function Helper function to build most common HAVING conditional clauses. Overrides SelectQueryInterface::havingCondition
SelectQueryExtender::havingConditions public function
SelectQueryExtender::innerJoin public function Inner Join against another table in the database. Overrides SelectQueryInterface::innerJoin
SelectQueryExtender::isNotNull function Sets a condition that the specified field be NOT NULL. Overrides QueryConditionInterface::isNotNull
SelectQueryExtender::isNull function Sets a condition that the specified field be NULL. Overrides QueryConditionInterface::isNull
SelectQueryExtender::isPrepared public function Indicates if preExecute() has already been called on that object. Overrides SelectQueryInterface::isPrepared
SelectQueryExtender::join public function Default Join against another table in the database. Overrides SelectQueryInterface::join
SelectQueryExtender::leftJoin public function Left Outer Join against another table in the database. Overrides SelectQueryInterface::leftJoin
SelectQueryExtender::nextPlaceholder public function Implements QueryPlaceholderInterface::nextPlaceholder(). Overrides QueryPlaceholderInterface::nextPlaceholder
SelectQueryExtender::notExists public function Sets a condition that the specified subquery returns no values. Overrides QueryConditionInterface::notExists
SelectQueryExtender::orderBy public function Orders the result set by a given field. Overrides SelectQueryInterface::orderBy
SelectQueryExtender::orderRandom public function Orders the result set by a random value. Overrides SelectQueryInterface::orderRandom
SelectQueryExtender::preExecute public function Generic preparation and validation for a SELECT query. Overrides SelectQueryInterface::preExecute
SelectQueryExtender::range public function Restricts a query to a given range in the result set. Overrides SelectQueryInterface::range
SelectQueryExtender::rightJoin public function Right Outer Join against another table in the database. Overrides SelectQueryInterface::rightJoin
SelectQueryExtender::union public function Add another Select query to UNION to this one. Overrides SelectQueryInterface::union
SelectQueryExtender::uniqueIdentifier public function Implements QueryPlaceholderInterface::uniqueIdentifier(). Overrides QueryPlaceholderInterface::uniqueIdentifier
SelectQueryExtender::where public function Adds an arbitrary WHERE clause to the query. Overrides QueryConditionInterface::where
SelectQueryExtender::__call public function Magic override for undefined methods.
SelectQueryExtender::__clone public function Clone magic method. Overrides SelectQueryInterface::__clone
SelectQueryExtender::__toString public function