Skip to content

Commit 326e7aa

Browse files
author
Ralf Schlatterbeck
committed
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.
1 parent 5ef9b3b commit 326e7aa

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

roundup/backends/rdbms_common.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: rdbms_common.py,v 1.175 2006-08-21 12:19:48 schlatterbeck Exp $
18+
#$Id: rdbms_common.py,v 1.176 2006-08-22 19:27:36 schlatterbeck Exp $
1919
''' Relational database (SQL) backend common code.
2020
2121
Basics:
@@ -2129,20 +2129,23 @@ def filter(self, search_matches, filterspec, sort=[], group=[]):
21292129
args.append(v)
21302130
if p.sort_type > 0:
21312131
oc = ac = '_%s.id'%pln
2132-
elif isinstance(propclass, String) and p.sort_type < 2:
2133-
if not isinstance(v, type([])):
2134-
v = [v]
2135-
2136-
# Quote the bits in the string that need it and then embed
2137-
# in a "substring" search. Note - need to quote the '%' so
2138-
# they make it through the python layer happily
2139-
v = ['%%'+self.db.sql_stringquote(s)+'%%' for s in v]
2140-
2141-
# now add to the where clause
2142-
where.append('('
2143-
+' and '.join(["_%s._%s LIKE '%s'"%(pln, k, s) for s in v])
2144-
+')')
2145-
# note: args are embedded in the query string now
2132+
elif isinstance(propclass, String):
2133+
if p.sort_type < 2:
2134+
if not isinstance(v, type([])):
2135+
v = [v]
2136+
2137+
# Quote the bits in the string that need it and then embed
2138+
# in a "substring" search. Note - need to quote the '%' so
2139+
# they make it through the python layer happily
2140+
v = ['%%'+self.db.sql_stringquote(s)+'%%' for s in v]
2141+
2142+
# now add to the where clause
2143+
where.append('('
2144+
+' and '.join(["_%s._%s LIKE '%s'"%(pln, k, s) for s in v])
2145+
+')')
2146+
# note: args are embedded in the query string now
2147+
if p.sort_type > 0:
2148+
oc = ac = 'lower(_%s._%s)'%(pln, k)
21462149
elif isinstance(propclass, Link):
21472150
if p.sort_type < 2:
21482151
if p.children:

0 commit comments

Comments
 (0)