public override CosmosElement Visit(SqlSelectStarSpec selectSpec, CosmosElement document) { if (selectSpec == null) { throw new ArgumentNullException(nameof(selectSpec)); } CosmosObject documentAsObject = (CosmosObject)document; Dictionary <string, CosmosElement> properties = new Dictionary <string, CosmosElement>(); foreach (KeyValuePair <string, CosmosElement> kvp in documentAsObject) { // remove the _rid since it's not needed at this point. if (kvp.Key != "_rid") { properties[kvp.Key] = kvp.Value; } } // if the document only has one property then it means // that the object was wrapped for binding and needs to be unwrapped. if (properties.Count != 1) { throw new ArgumentException("Tried to run SELECT * on a JOIN query"); } return(properties.First().Value); }
public override bool Visit(SqlSelectStarSpec first, SqlObject secondAsObject) { if (!(secondAsObject is SqlSelectStarSpec second)) { return(false); } return(true); }
private QueryUnderConstruction PackageQuery(HashSet <ParameterExpression> inScope) { QueryUnderConstruction result = new QueryUnderConstruction(); var inputParam = result.fromParameters.SetInputParameter(typeof(object), ParameterSubstitution.InputParameterName, inScope); inScope.Add(inputParam); result.inputQuery = this; if (this.selectClause == null) { var star = new SqlSelectStarSpec(); this.selectClause = new SqlSelectClause(star, null); } return(result); }
public void SqlSelectStarSpecTest() { CosmosObject john = CosmosObject.Create(new Dictionary <string, CosmosElement> { ["name"] = CosmosString.Create("John") }); CosmosObject johnWrapped = CosmosObject.Create(new Dictionary <string, CosmosElement> { ["c"] = john }); SqlSelectStarSpec star = SqlSelectStarSpec.Singleton; AssertEvaluation(john, star, johnWrapped); }
public override void Visit(SqlSelectStarSpec sqlSelectStarSpec) { this.writer.Write("*"); }
public override SqlObject Visit(SqlSelectStarSpec sqlSelectStarSpec) { // Not PII return(sqlSelectStarSpec); }
public override bool Visit(SqlSelectStarSpec selectSpec) { return(false); }
public override SqlObject VisitSelect_star_spec([NotNull] sqlParser.Select_star_specContext context) { Contract.Requires(context != null); return(SqlSelectStarSpec.Create()); }
public abstract TOutput Visit(SqlSelectStarSpec selectSpec, TArg input);
public abstract void Visit(SqlSelectStarSpec selectSpec);
public abstract TResult Visit(SqlSelectStarSpec sqlObject);
public override void Visit(SqlSelectStarSpec selectSpec) { // SELECT * is always okay. return; }
public abstract TResult Visit(SqlSelectStarSpec selectSpec);
public abstract TOutput Visit(SqlSelectStarSpec sqlObject, TArg input);
public override int Visit(SqlSelectStarSpec sqlSelectStarSpec) { return(SqlSelectStarSpecHashCode); }
public abstract void Visit(SqlSelectStarSpec sqlObject);
public override SqlSelectSpec Visit(SqlSelectStarSpec selectSpec) { return(selectSpec); }