[banshee/1.5.1-fixes: 45/56] Use CROSS JOINs to force join order (bgo#581103)



commit 0a2a8f167347866e955cdb7e2d2838453121122d
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Sun Dec 27 13:22:02 2009 +1100

    Use CROSS JOINs to force join order (bgo#581103)

 .../DatabaseTrackListModel.cs                      |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
index afcf511..db13ae2 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
@@ -200,7 +200,18 @@ namespace Banshee.Collection.Database
 
         private string from;
         protected string From {
-            get { return from ?? provider.From; }
+            get {
+                if (from == null) {
+                    from = provider.From;
+                    int i = from.IndexOf (',');
+                    if (i > 0) {
+                        // Force the join order to fix bgo#581103 and bgo#603661
+                        // See section 5.2 in http://www.sqlite.org/optoverview.html
+                        from = from.Substring (0, i) + " CROSS JOIN " + from.Substring (i + 1);
+                    }
+                }
+                return from;
+            }
             set { from = value; }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]