Revision 2214
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
36 | 36 |
str_ += sql.esc_name(db, self.name) |
37 | 37 |
return str_ |
38 | 38 |
|
39 |
class ValueCond(Code):
|
|
39 |
class ValueCond: |
|
40 | 40 |
def __init__(self, value): |
41 | 41 |
if not isinstance(value, Literal): value = Literal(value) |
42 | 42 |
|
43 | 43 |
self.value = value |
44 |
|
|
45 |
def to_str(self, db, value_code): |
|
46 |
''' |
|
47 |
@param value_code The SQL code that the condition is being applied on |
|
48 |
''' |
|
49 |
raise NotImplemented() |
|
44 | 50 |
|
45 | 51 |
class CompareCond(ValueCond): |
46 | 52 |
def __init__(self, value, operator='='): |
47 | 53 |
ValueCond.__init__(self, value) |
48 | 54 |
self.operator = operator |
49 | 55 |
|
50 |
def to_str(self, db): return self.operator+' '+self.value.to_str(db) |
|
56 |
def to_str(self, db, value_code): |
|
57 |
return value_code+' '+self.operator+' '+self.value.to_str(db) |
Also available in: Unified diff
sql_gen.py: ValueCond.to_str(): Added value_code param