Changeset 55
- Timestamp:
- 01/20/05 06:45:39
- Files:
-
- trunk/storage/storepypgsql.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/storage/storepypgsql.py
r54 r55 6 6 7 7 8 class AdapterToPgSQL(db.AdapterToSQL): 9 10 like_escapes = [("%", r"\\%"), ("_", r"\\_")] 11 12 8 13 class PgSQLDecompiler(db.SQLDecompiler): 9 14 … … 11 16 if isinstance(op1, db.ConstWrapper): 12 17 # Looking for text in a field. Use ILike (reverse terms). 13 return op2 + " ILIKE '%" + op1.strip("'\"") + "%'"18 return op2 + " ILIKE '%" + self.adapter.escape_like(op1) + "%'" 14 19 else: 15 20 # Looking for field in (a, b, c). … … 19 24 20 25 def dejavu_istartswith(self, x, y): 21 return x + " ILIKE '" + y.strip("'\"") + "%'"26 return x + " ILIKE '" + self.adapter.escape_like(y) + "%'" 22 27 23 28 def dejavu_iendswith(self, x, y): 24 return x + " ILIKE '%" + y.strip("'\"") + "'"29 return x + " ILIKE '%" + self.adapter.escape_like(y) + "'" 25 30 26 31 def dejavu_ieq(self, x, y): 27 32 # ILIKE with no wildcards should behave like ieq. 28 return x + " ILIKE " + y33 return x + " ILIKE '" + self.adapter.escape_like(y) + "'" 29 34 30 35 def dejavu_year(self, x): … … 39 44 close_connection_method = 'finish' 40 45 decompiler = PgSQLDecompiler 46 toAdapter = AdapterToPgSQL() 41 47 42 48 def __init__(self, name, arena, allOptions={}):
