Exemplo n.º 1
0
        public void SqlWhileCloneTest()
        {
            SqlVariable i = SqlDml.Variable("i", SqlType.Int32);
            SqlWhile    w = SqlDml.While(i <= 1000);
            SqlBatch    b = SqlDml.Batch();

            b.Add(SqlDml.Assign(i, i + 1));
            SqlTableRef t = SqlDml.TableRef(table1);
            SqlSelect   s = SqlDml.Select(t);

            s.Columns.Add(t["Name"]);
            s.Where = t[0] == i;
            SqlIf f = SqlDml.If(SqlDml.SubQuery(s) == "Unkown", SqlDml.Break, SqlDml.Continue);

            b.Add(f);
            w.Statement = b;

            SqlWhile wClone = (SqlWhile)w.Clone();

            Assert.AreNotEqual(w, wClone);
            Assert.AreEqual(w.NodeType, wClone.NodeType);
            Assert.AreNotEqual(w.Condition, wClone.Condition);
            Assert.AreEqual(w.Condition.NodeType, wClone.Condition.NodeType);
            Assert.AreNotEqual(w.Statement, wClone.Statement);
            Assert.AreEqual(w.Statement.NodeType, wClone.Statement.NodeType);
        }
Exemplo n.º 2
0
 public void Visit(SqlWhile node)
 {
     if (!node.Condition.IsNullReference())
     {
         Visit(node.Condition);
     }
     if (node.Statement != null)
     {
         Visit(node.Statement);
     }
 }
Exemplo n.º 3
0
 public virtual void Visit(SqlWhile node)
 {
     VisitInternal(node.Condition);
     VisitInternal(node.Statement);
 }