public override void VisitSelectClause(SelectClause selectClause, QueryModel queryModel) { Log("VisitSelectClause: " + selectClause, logLevel++); _queryParts.SelectPart = SqlExpressionTreeVisitor.GetSqlExpression(selectClause.Selector, ","); base.VisitSelectClause(selectClause, queryModel); logLevel--; }
public override void VisitWhereClause(WhereClause whereClause, QueryModel queryModel, int index) { Log($"VisitWhereClause({index}): " + whereClause, logLevel++); _queryParts.AddWherePart(SqlExpressionTreeVisitor.GetSqlExpression(whereClause.Predicate)); base.VisitWhereClause(whereClause, queryModel, index); logLevel--; }
public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index) { Log($"VisitOrderByClause({index}): " + orderByClause, logLevel++); var orderings = orderByClause.Orderings; _queryParts.AddOrderByPart(orderings.Select(item => SqlExpressionTreeVisitor.GetSqlExpression(item.Expression) + " " + item.OrderingDirection)); base.VisitOrderByClause(orderByClause, queryModel, index); logLevel--; }
private string GetFilter(JoinClause joinClause, string newItemName = null) { //TODO var filter = $"({SqlExpressionTreeVisitor.GetSqlExpression(joinClause.OuterKeySelector)} = {SqlExpressionTreeVisitor.GetSqlExpression(joinClause.InnerKeySelector)})"; if (newItemName != null) { filter = filter.Replace($"\"{joinClause.ItemName}\".", $"\"{newItemName}\"."); } return(filter); }