|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
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 $ |
19 | 19 | ''' Relational database (SQL) backend common code. |
20 | 20 |
|
21 | 21 | Basics: |
@@ -2129,20 +2129,23 @@ def filter(self, search_matches, filterspec, sort=[], group=[]): |
2129 | 2129 | args.append(v) |
2130 | 2130 | if p.sort_type > 0: |
2131 | 2131 | 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) |
2146 | 2149 | elif isinstance(propclass, Link): |
2147 | 2150 | if p.sort_type < 2: |
2148 | 2151 | if p.children: |
|
0 commit comments