diff roundup/backends/rdbms_common.py @ 2318:fa2f7ba34399

merge from maint-0-7
author Richard Jones <richard@users.sourceforge.net>
date Sun, 16 May 2004 09:35:50 +0000
parents 3197e37346de
children 7cf7e3bd1b31
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Sun May 16 09:23:18 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Sun May 16 09:35:50 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.99 2004-05-10 01:30:02 richard Exp $
+# $Id: rdbms_common.py,v 1.100 2004-05-16 09:35:49 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -2123,7 +2123,7 @@
                     args.append(v)
 
         # don't match retired nodes
-        where.append('__retired__ <> 1')
+        where.append('_%s.__retired__ <> 1'%cn)
 
         # add results of full text search
         if search_matches is not None:
@@ -2146,6 +2146,16 @@
                     # use the int column for sorting
                     o = '__'+prop+'_int__'
                     ordercols.append(o)
+                elif isinstance(props[prop], Link):
+                    # determine whether the linked Class has an order property
+                    lcn = props[prop].classname
+                    link = self.db.classes[lcn]
+                    if link.getprops().has_key('order'):
+                        tn = '_' + lcn
+                        frum.append(tn)
+                        where.append('_%s._%s = %s.id'%(cn, prop, tn))
+                        ordercols.append(tn + '._order')
+                        o = tn + '._order'
                 elif prop == 'id':
                     o = 'id'
                 else:
@@ -2164,9 +2174,9 @@
         if mlfilt:
             # we're joining tables on the id, so we will get dupes if we
             # don't distinct()
-            cols = ['distinct(id)']
+            cols = ['distinct(_%s.id)'%cn]
         else:
-            cols = ['id']
+            cols = ['_%s.id'%cn]
         if orderby:
             cols = cols + ordercols
             order = ' order by %s'%(','.join(orderby))

Roundup Issue Tracker: http://roundup-tracker.org/