/// <summary> /// Adds the specified sub query. /// </summary> /// <param name="subQuery">The sub query to consider.</param> /// <returns>Return this added parameter.</returns> public DataExpression UseSubQuery(IDbQuery subQuery) { if (SubQueries == null) SubQueries = new List<DbQuery>(); SubQueries.Add((DbQuery)subQuery); return BdoScript.Function("sqlQuery", SubQueries.Count.ToString()).CreateExp(); }
/// Closes the subquery parts aggregator and adds a subquery as a part of this query. /// /// If a subquery parts aggregator is open and is also visiting a subquery, /// redirects the call to it instead. public void CloseSubQueryExpressionPartsAggregator() { if (_visitingSubQueryExpression && _subQueryExpressionPartsAggregator._visitingSubQueryExpression) { _subQueryExpressionPartsAggregator.CloseSubQueryExpressionPartsAggregator(); } else { if (string.IsNullOrEmpty(SelectPart)) { SelectPart = _subQueryExpressionPartsAggregator.SelectPart; } else { SubQueries.Add(_subQueryExpressionPartsAggregator.BuildQueryStatement().Trim(';')); } _visitingSubQueryExpression = false; } }
private void CreateSubQuery(string alias, Type type) { var subQuery = AliasedSqlSubQuery.Create(alias, type, _conventionReader); SubQueries.Add(subQuery); }