Mercurial > p > roundup > code
comparison roundup/backends/back_mysql.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 | 0b198ed096af |
| children | 7cf7e3bd1b31 |
comparison
equal
deleted
inserted
replaced
| 2316:f8a4c51e5847 | 2318:fa2f7ba34399 |
|---|---|
| 636 else: | 636 else: |
| 637 where.append('_%s=%s'%(k, a)) | 637 where.append('_%s=%s'%(k, a)) |
| 638 args.append(v) | 638 args.append(v) |
| 639 | 639 |
| 640 # don't match retired nodes | 640 # don't match retired nodes |
| 641 where.append('__retired__ <> 1') | 641 where.append('_%s.__retired__ <> 1'%cn) |
| 642 | 642 |
| 643 # add results of full text search | 643 # add results of full text search |
| 644 if search_matches is not None: | 644 if search_matches is not None: |
| 645 v = search_matches.keys() | 645 v = search_matches.keys() |
| 646 s = ','.join([a for x in v]) | 646 s = ','.join([a for x in v]) |
| 659 continue | 659 continue |
| 660 elif isinstance(props[prop], Interval): | 660 elif isinstance(props[prop], Interval): |
| 661 # use the int column for sorting | 661 # use the int column for sorting |
| 662 o = '__'+prop+'_int__' | 662 o = '__'+prop+'_int__' |
| 663 ordercols.append(o) | 663 ordercols.append(o) |
| 664 elif isinstance(props[prop], Link): | |
| 665 # determine whether the linked Class has an order property | |
| 666 lcn = props[prop].classname | |
| 667 link = self.db.classes[lcn] | |
| 668 if link.getprops().has_key('order'): | |
| 669 tn = '_' + lcn | |
| 670 frum.append(tn) | |
| 671 where.append('_%s._%s = %s.id'%(cn, prop, tn)) | |
| 672 ordercols.append(tn + '._order') | |
| 673 o = tn + '._order' | |
| 664 elif prop == 'id': | 674 elif prop == 'id': |
| 665 o = 'id' | 675 o = 'id' |
| 666 else: | 676 else: |
| 667 o = '_'+prop | 677 o = '_'+prop |
| 668 ordercols.append(o) | 678 ordercols.append(o) |
| 677 else: | 687 else: |
| 678 where = '' | 688 where = '' |
| 679 if mlfilt: | 689 if mlfilt: |
| 680 # we're joining tables on the id, so we will get dupes if we | 690 # we're joining tables on the id, so we will get dupes if we |
| 681 # don't distinct() | 691 # don't distinct() |
| 682 cols = ['distinct(id)'] | 692 cols = ['distinct(_%s.id)'%cn] |
| 683 else: | 693 else: |
| 684 cols = ['id'] | 694 cols = ['_%s.id'%cn] |
| 685 if orderby: | 695 if orderby: |
| 686 cols = cols + ordercols | 696 cols = cols + ordercols |
| 687 order = ' order by %s'%(','.join(orderby)) | 697 order = ' order by %s'%(','.join(orderby)) |
| 688 else: | 698 else: |
| 689 order = '' | 699 order = '' |
