Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 3683:ad5e1d75e028
Fixes:
- Fixed StringSort test case to require case-insensitive sorting
- Fixed hyperdb sort_repr for String to user lower()
- Fixed SQL backends to sort by lower(string) -- only mysql sorts
lowercase by default, so doing a special case for mysql didn't seem
worth the effort.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Tue, 22 Aug 2006 19:27:36 +0000 |
| parents | 193f316dbbe9 |
| children | 4d9adb8bc3b1 |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Mon Aug 21 12:19:48 2006 +0000 +++ b/roundup/backends/rdbms_common.py Tue Aug 22 19:27:36 2006 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: rdbms_common.py,v 1.175 2006-08-21 12:19:48 schlatterbeck Exp $ +#$Id: rdbms_common.py,v 1.176 2006-08-22 19:27:36 schlatterbeck Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -2129,20 +2129,23 @@ args.append(v) if p.sort_type > 0: oc = ac = '_%s.id'%pln - elif isinstance(propclass, String) and p.sort_type < 2: - if not isinstance(v, type([])): - v = [v] - - # Quote the bits in the string that need it and then embed - # in a "substring" search. Note - need to quote the '%' so - # they make it through the python layer happily - v = ['%%'+self.db.sql_stringquote(s)+'%%' for s in v] - - # now add to the where clause - where.append('(' - +' and '.join(["_%s._%s LIKE '%s'"%(pln, k, s) for s in v]) - +')') - # note: args are embedded in the query string now + elif isinstance(propclass, String): + if p.sort_type < 2: + if not isinstance(v, type([])): + v = [v] + + # Quote the bits in the string that need it and then embed + # in a "substring" search. Note - need to quote the '%' so + # they make it through the python layer happily + v = ['%%'+self.db.sql_stringquote(s)+'%%' for s in v] + + # now add to the where clause + where.append('(' + +' and '.join(["_%s._%s LIKE '%s'"%(pln, k, s) for s in v]) + +')') + # note: args are embedded in the query string now + if p.sort_type > 0: + oc = ac = 'lower(_%s._%s)'%(pln, k) elif isinstance(propclass, Link): if p.sort_type < 2: if p.children:
