CloneSet337


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
35260.974class_member_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13592
src/NHibernate.Test/NHSpecificTest/NH1098/FilterParameterOrderFixture.cs
235129
src/NHibernate.Test/NHSpecificTest/NH1098/FilterParameterOrderFixture.cs
Clone Instance
1
Line Count
35
Source Line
92
Source File
src/NHibernate.Test/NHSpecificTest/NH1098/FilterParameterOrderFixture.cs

                [Test]
                public void QueryWithNamedParameters()
                {
                        ISession session = OpenSession();
                        session.EnableFilter("EnabledObjects").SetParameter("Enabled", true);

                        var sql = new StringBuilder();
                        sql.Append("from A as a where a.ValueA < :ValA");
                        sql.Append(" and exists (select b.ValueB from B as b where ");
                        sql.Append(" a.ValueA < b.ValueB and b.ValueB > :ValB)");

                        IQuery query = session.CreateQuery(sql.ToString());
                        query.SetParameter("ValA", 6);
                        query.SetParameter("ValB", 5);

                        //
                        // Query:
                        // {select a0_.id as id0_, a0_.val_a as val2_0_, a0_.enabled as enabled0_ 
                        //     from table_a a0_ 
                        //     where a0_.enabled = ? and ((a0_.val_a<? )and
                        //        (exists(select b1_.val_b 
                        //            from table_b b1_ 
                        //            where b1_.enabled = ? and ((a0_.val_a<b1_.val_b )and(b1_.val_b>? )))))}
                        // 
                        // Parameter:
                        // 1) "this_.enabled = :EnabledObjects.Enabled" [filter #1]
                        // 2) "this_.val_a < (?)" [named parameter #1]
                        // 3) "this_0_.enabled = :EnabledObjects.Enabled" [filter #2]
                        // 4) "this_0_.val_b > (?)" [named parameter #2]
                        // 
                        // => ERROR, parameters are in wrong order: filter #1, filter #2, named #1, named #2
                        //

                        IList<A> result = query.List<A> ();
                        Assert.AreEqual(1, result.Count);
                }



Clone Instance
2
Line Count
35
Source Line
129
Source File
src/NHibernate.Test/NHSpecificTest/NH1098/FilterParameterOrderFixture.cs

                [Test]
                public void QueryWithPositionalParameter()
                {
                        ISession session = OpenSession();
                        session.EnableFilter("EnabledObjects").SetParameter("Enabled", true);

                        var sql = new StringBuilder();
                        sql.Append("from A as a where a.ValueA < ?");
                        sql.Append(" and exists (select b.ValueB from B as b where ");
                        sql.Append(" a.ValueA < b.ValueB and b.ValueB > ?)");

                        IQuery query = session.CreateQuery(sql.ToString());
                        query.SetInt32(0, 6);
                        query.SetInt32(1, 5);

                        //
                        // Query:
                        // {select a0_.id as id0_, a0_.val_a as val2_0_, a0_.enabled as enabled0_ 
                        //     from table_a a0_ 
                        //     where a0_.enabled = ? and ((a0_.val_a<? )and
                        //        (exists(select b1_.val_b 
                        //                  from table_b b1_ 
                        //                  where b1_.enabled = ? and ((a0_.val_a<b1_.val_b )and(b1_.val_b>? )))))}
                        // 
                        // Parameter:
                        // 1) "this_.enabled = :EnabledObjects.Enabled" [filter #1]
                        // 2) "this_.val_a < (?)" [positional parameter #1]
                        // 3) "this_0_.enabled = :EnabledObjects.Enabled" [filter #2]
                        // 4) "this_0_.val_b > (?)" [positional parameter #2]
                        // 
                        // => OK, parameters are in correct order: filter #1, pos 12, filter #2, pos #2
                        //

                        IList<A> result = query.List<A> ();
                        Assert.AreEqual(1, result.Count);
                }



Clone AbstractionParameter Count: 6Parameter Bindings

[Test]
public void [[#variable6b72b5c0]]()
{
   ISession session = OpenSession();
   session.EnableFilter("EnabledObjects").SetParameter("Enabled", true);
   var sql = new StringBuilder();
   sql.Append( [[#variable6b72b560]]);
   sql.Append(" and exists (select b.ValueB from B as b where ");
   sql.Append( [[#variable6b72b500]]);
   IQuery query = session.CreateQuery(sql.ToString());
   query. [[#variable6c563e60]]( [[#variable68a20120]], 6);
   query. [[#variable6c563e60]]( [[#variable6b72b360]], 5);
   //
   // Query:
   // {select a0_.id as id0_, a0_.val_a as val2_0_, a0_.enabled as enabled0_ 
   //     from table_a a0_ 
   //     where a0_.enabled = ? and ((a0_.val_a<? )and
   //        (exists(select b1_.val_b 
   //                  from table_b b1_ 
   //                  where b1_.enabled = ? and ((a0_.val_a<b1_.val_b )and(b1_.val_b>? )))))}
   //            from table_b b1_ 
   //            where b1_.enabled = ? and ((a0_.val_a<b1_.val_b )and(b1_.val_b>? )))))}
   // 
   // Parameter:
   // 1) "this_.enabled = :EnabledObjects.Enabled" [filter #1]
   // 2) "this_.val_a < (?)" [positional parameter #1]
   // 2) "this_.val_a < (?)" [named parameter #1]
   // 3) "this_0_.enabled = :EnabledObjects.Enabled" [filter #2]
   // 4) "this_0_.val_b > (?)" [positional parameter #2]
   // 4) "this_0_.val_b > (?)" [named parameter #2]
   // 
   // => OK, parameters are in correct order: filter #1, pos 12, filter #2, pos #2
   // => ERROR, parameters are in wrong order: filter #1, filter #2, named #1, named #2
   //
   IList<A> result = query.List<A> ();
   Assert.AreEqual(1, result.Count);
}

 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#6b72b5c0]]
QueryWithPositionalParameter 
12[[#6b72b5c0]]
QueryWithNamedParameters 
21[[#6b72b560]]
"from A as a where a.ValueA < ?" 
22[[#6b72b560]]
"from A as a where a.ValueA < :ValA" 
31[[#6b72b500]]
" a.ValueA < b.ValueB and b.ValueB > ?)" 
32[[#6b72b500]]
" a.ValueA < b.ValueB and b.ValueB > :ValB)" 
41[[#6c563e60]]
SetInt32 
42[[#6c563e60]]
SetParameter 
51[[#68a20120]]
0 
52[[#68a20120]]
"ValA" 
61[[#6b72b360]]
1 
62[[#6b72b360]]
"ValB"