/**
  * Builds a sql query with the specified connection
  *
  * @param SQLExpression $query The expression object to build from
  * @param array $parameters Out parameter for the resulting query parameters
  * @return string The resulting SQL as a string
  */
 public function buildSQL(SQLExpression $query, &$parameters)
 {
     $sql = null;
     $parameters = array();
     // Ignore null queries
     if ($query->isEmpty()) {
         return null;
     }
     if ($query instanceof SQLSelect) {
         $sql = $this->buildSelectQuery($query, $parameters);
     } elseif ($query instanceof SQLDelete) {
         $sql = $this->buildDeleteQuery($query, $parameters);
     } elseif ($query instanceof SQLInsert) {
         $sql = $this->buildInsertQuery($query, $parameters);
     } elseif ($query instanceof SQLUpdate) {
         $sql = $this->buildUpdateQuery($query, $parameters);
     } else {
         user_error("Not implemented: query generation for type " . $query->getType());
     }
     return $sql;
 }
 /**
  * Builds a sql query with the specified connection
  *
  * @param SQLExpression $query The expression object to build from
  * @param array $parameters Out parameter for the resulting query parameters
  * @return string The resulting SQL as a string
  */
 public function buildSQL(SQLExpression $query, &$parameters)
 {
     $sql = null;
     $parameters = array();
     // Ignore null queries
     if ($query->isEmpty()) {
         return null;
     }
     if ($query instanceof SQLSelect) {
         $sql = $this->buildSelectQuery($query, $parameters);
     } elseif ($query instanceof SQLDelete) {
         $sql = $this->buildDeleteQuery($query, $parameters);
     } elseif ($query instanceof SQLInsert) {
         $sql = $this->buildInsertQuery($query, $parameters);
     } elseif ($query instanceof SQLUpdate) {
         $sql = $this->buildUpdateQuery($query, $parameters);
     } else {
         throw new InvalidArgumentException("Not implemented: query generation for type " . get_class($query));
     }
     return $sql;
 }