List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:August 4 2009 10:17pm
Subject:bzr commit into connector-net-6.1 branch (reggie.burnett:730)
View as plain text  
#At file:///D:/bzr-connector-net/6.1/ based on revid:reggie.burnett@stripped

  730 Reggie Burnett	2009-08-04 [merge]
      merged

    modified:
      CHANGES
      MySql.Data.Entity/Provider/Generators/SelectGenerator.cs
      MySql.Data.Entity/Tests/Paging.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2009-08-04 15:22:05 +0000
+++ b/CHANGES	2009-08-04 22:16:59 +0000
@@ -20,6 +20,8 @@
 - fixed mono compilation by removing the space delimited warning list from the project file
   and including a solution that builds with MonoDevelop 2.0. (bug #42411)
 - fixed 'can't find svctag.xml' installer bug (thanks Iggy!)  (bug #45474)
+- fixed DbSkipExpression so that it would respect any sort clauses that are attached
+  (thanks Lynn!) (bug #45723)
   
 Version 6.0.4
 - fixed regression where using stored procs with datasets (bug #44460)

=== modified file 'MySql.Data.Entity/Provider/Generators/SelectGenerator.cs'
--- a/MySql.Data.Entity/Provider/Generators/SelectGenerator.cs	2009-04-21 18:02:13 +0000
+++ b/MySql.Data.Entity/Provider/Generators/SelectGenerator.cs	2009-08-04 22:16:21 +0000
@@ -255,6 +255,13 @@
             SelectStatement select = VisitInputExpressionEnsureSelect(expression.Input.Expression, expression.Input.VariableName,
                 expression.Input.VariableType);
 
+            foreach (DbSortClause sortClause in expression.SortOrder)
+            {
+                select.AddOrderBy(
+                    new SortFragment(sortClause.Expression.Accept(this), sortClause.Ascending));
+            }
+
+
             select = WrapIfNotCompatible(select, expression.ExpressionKind);
             select.Skip = expression.Count.Accept(this);
             return select;

=== modified file 'MySql.Data.Entity/Tests/Paging.cs'
--- a/MySql.Data.Entity/Tests/Paging.cs	2009-04-21 18:02:13 +0000
+++ b/MySql.Data.Entity/Tests/Paging.cs	2009-08-04 22:16:21 +0000
@@ -23,6 +23,7 @@
 using System.Threading;
 using MySql.Data.MySqlClient;
 using MySql.Data.MySqlClient.Tests;
+using System.Linq;
 using System.Data.EntityClient;
 using System.Data.Common;
 using NUnit.Framework;
@@ -100,5 +101,24 @@
                 Assert.AreEqual(2, i);
             }
         }
+
+        /// <summary>
+        /// Bug #45723 Entity Framework DbSortExpression not processed when using Skip & Take  
+        /// </summary>
+        [Test]
+        public void SkipAndTakeWithOrdering()
+        {
+            using (testEntities context = new testEntities())
+            {
+                MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM Companies ORDER BY Name DESC LIMIT 2,2", conn);
+                DataTable dt = new DataTable();
+                da.Fill(dt);
+
+                int i = 0;
+                var query = context.Companies.OrderByDescending(q => q.Name).Skip(2).Take(2).ToList();
+                foreach (Company c in query)
+                    Assert.AreEqual(dt.Rows[i++]["Name"], c.Name);
+            }
+        }
     }
 }
\ No newline at end of file


Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20090804221659-ch7vc15wnge0zu1h.bundle
Thread
bzr commit into connector-net-6.1 branch (reggie.burnett:730)Reggie Burnett4 Aug