public override QueryNode Visit(MemberAccessNode nodeIn) { string memberName = SqlHelpers.FormatMember(nodeIn.MemberName); _sql.Append(memberName); return(nodeIn); }
public string FormatSelect() { var command = new StringBuilder("SELECT "); if (_query.Selection.Any()) { string columnNames = string.Join(", ", _query.Selection.Select(c => SqlHelpers.FormatMember(c))); command.Append(columnNames); } else { command.Append("*"); } return(FormatQuery(command.ToString())); }
public string FormatDelete() { var delQuery = _query.Clone(); // create a copy to avoid modifying the original delQuery.Selection.Clear(); delQuery.Selection.Add(MobileServiceSystemColumns.Id); delQuery.IncludeTotalCount = false; var formatter = new SqlQueryFormatter(delQuery); string selectIdQuery = formatter.FormatSelect(); string idMemberName = SqlHelpers.FormatMember(MobileServiceSystemColumns.Id); string tableName = SqlHelpers.FormatTableName(delQuery.TableName); string command = $"DELETE FROM {tableName} WHERE {idMemberName} IN ({selectIdQuery})"; Parameters = formatter.Parameters; return(command); }