Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
 }
Esempio n. 7
0
 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);
Esempio n. 10
0
 public abstract void Visit(SqlSelectStarSpec selectSpec);
Esempio n. 11
0
 public abstract TResult Visit(SqlSelectStarSpec sqlObject);
Esempio n. 12
0
 public override void Visit(SqlSelectStarSpec selectSpec)
 {
     // SELECT * is always okay.
     return;
 }
Esempio n. 13
0
 public abstract TResult Visit(SqlSelectStarSpec selectSpec);
Esempio n. 14
0
 public abstract TOutput Visit(SqlSelectStarSpec sqlObject, TArg input);
 public override int Visit(SqlSelectStarSpec sqlSelectStarSpec)
 {
     return(SqlSelectStarSpecHashCode);
 }
Esempio n. 16
0
 public abstract void Visit(SqlSelectStarSpec sqlObject);
 public override SqlSelectSpec Visit(SqlSelectStarSpec selectSpec)
 {
     return(selectSpec);
 }