public void TestFromComments() { string code = @" /* this is a comment */ select * from "; var context = RunContext.CreateIntellisenseContext(code, new Cursor(7, 5)); context.Run(); Assert.IsTrue(context.ScopeModel.Global.Items.Count != 0); Assert.IsTrue(context.ScopeModel.QueryScope.Items.Count == 0); }
public void TestJoinConditionNoWhereAnd() { string code = @" select * from airlineflightschedules a join getflightid o on o.ident = a.ident and o.departuretime = a. where departuretime > '2020-4-10 1:00' and origin = 'kaus' "; var context = RunContext.CreateIntellisenseContext(code, new Cursor(2, 3)); context.Run(); Assert.IsTrue(context.ScopeModel.Global.Items.Count != 0); Assert.IsTrue(context.ScopeModel.QueryScope.Items.Count == 2); Assert.IsTrue(context.ScopeModel.QueryScope.Items.ContainsKey("a")); Assert.IsTrue(context.ScopeModel.QueryScope.Items.ContainsKey("o")); }
public void TestMultpleJoin() { string code = @" select f.ident, f.departuretime, f.arrivaltime, d.name from airlineflightschedules f join airportinfo d on d.airportCode = f.departuretime join where f.departuretime > '2020-4-13 2:8' and f.origin = 'kaus' "; var context = RunContext.CreateIntellisenseContext(code, new Cursor(2, 3)); context.Run(); Assert.IsTrue(context.ScopeModel.Global.Items.Count != 0); Assert.IsTrue(context.ScopeModel.QueryScope.Items.ContainsKey("f")); Assert.IsTrue(context.ScopeModel.QueryScope.Items.ContainsKey("d")); }
public void TestInnerQueryEditSelect() { string code = @" select * from ( select from airlineflightschedules where actual_ident = '' ) a join airlineinfo "; var context = RunContext.CreateIntellisenseContext(code, new Cursor(4, 10)); context.Run(); Assert.IsTrue(context.ScopeModel.Global.Items.Count != 0); Assert.IsTrue(context.ScopeModel.QueryScope.Items.Count == 1); Assert.IsTrue(context.ScopeModel.QueryScope.Items.ContainsKey("airlineflightschedules")); }