Revision 2349
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
8 | 8 |
|
9 | 9 |
##### SQL code objects |
10 | 10 |
|
11 |
class MockDb: |
|
12 |
def esc_value(self, value): return strings.ustr(value) |
|
13 |
|
|
14 |
def esc_name(self, name): return name |
|
15 |
mockDb = MockDb() |
|
16 |
|
|
11 | 17 |
class Code(strings.DebugPrintable): |
12 | 18 |
def to_str(self, db): raise NotImplemented() |
19 |
|
|
20 |
def __str__(self): return self.to_str(mockDb) |
|
13 | 21 |
|
14 | 22 |
class CustomCode(Code): |
15 | 23 |
def __init__(self, str_): self.str_ = str_ |
... | ... | |
118 | 126 |
''' |
119 | 127 |
raise NotImplemented() |
120 | 128 |
|
121 |
def __str__(self): return str(self.__dict__)
|
|
129 |
def __str__(self): return self.to_str(mockDb, '')
|
|
122 | 130 |
|
123 | 131 |
class CompareCond(ValueCond): |
124 | 132 |
def __init__(self, value, operator='='): |
... | ... | |
212 | 220 |
if type_ != None: str_ += type_+' ' |
213 | 221 |
str_ += 'JOIN '+self.table.to_str(db)+' '+join_cond |
214 | 222 |
return str_ |
223 |
|
|
224 |
def __str__(self): return self.to_str(mockDb, '') |
Also available in: Unified diff
sql_gen.py: Added MockDb. All str() methods: Use self.to_str() with mockDb.