/// <summary> /// Returns the subselect clause of the statement /// being processed. /// </summary> /// <returns>An <see cref="SqlString" /> containing /// the subselect clause of the original <c>SELECT</c> /// statement.</returns> public SqlString GetSqlString() { using (var partEnumerator = sql.GetEnumerator()) { parenNestCount = 0; // Process the parts until FROM is found while (partEnumerator.MoveNext()) { var part = partEnumerator.Current; if (ProcessPartBeforeFrom(part)) { break; } } // Process the rest while (partEnumerator.MoveNext()) { AddPart(partEnumerator.Current); } } RemoveLastOrderByClause(); return(builder.ToSqlString()); }