Revision 2225
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
50 | 50 |
|
51 | 51 |
class ValueCond: |
52 | 52 |
def __init__(self, value): |
53 |
if not isinstance(value, Literal): value = Literal(value)
|
|
53 |
if not isinstance(value, Code): value = Literal(value)
|
|
54 | 54 |
|
55 | 55 |
self.value = value |
56 | 56 |
|
... | ... | |
128 | 128 |
|
129 | 129 |
if isinstance(value, tuple) and len(value) == 1: return Literal(value[0]) |
130 | 130 |
else: return col2sql_gen(value, default_table, table_is_esc) |
131 |
|
|
132 |
def cond2sql_gen(value, default_table=None, table_is_esc=False): |
|
133 |
'''Converts old-style (tuple-based) conditions to sql_gen-compatible values. |
|
134 |
@param table_is_esc If False, assumes any table name is not escaped or that |
|
135 |
re-escaping it will produce the same value. |
|
136 |
''' |
|
137 |
if isinstance(value, ValueCond): return value # already in sql_gen form |
|
138 |
|
|
139 |
return as_ValueCond(value2sql_gen(value, default_table, table_is_esc)) |
Also available in: Unified diff
sql_gen.py: ValueCond: Fixed bug where values which are Code objects were being converted to Literals. Added cond2sql_gen().