Example #1
0
        public void TestBasicSelect()
        {
            var input = "select * from table";

            var ctx = new Context();

            ctx.AddTable(new TableMeta()
            {
                Name = "table"
            });

            var command = new Parser().ParseStatement(input, ctx);

            Assert.IsTrue(command is SelectStatement);

            var expected = new SelectStatement()
            {
                MainSource = new ColumnReference()
                {
                    Table = "table"
                }
            };

            expected.OutputColumns.Add(new Expression()
            {
                Type     = Expression.ExpressionType.Unknown,
                FullText = "*",
                Nodes    = new List <Expression.Node>
                {
                    new Expression.Node()
                    {
                        Kind = Expression.NodeKind.Operator, OperatorValue = Operator.Asterisk
                    }
                }
            });

            Assert.AreEqual(command, expected);
        }