Revision 2294
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql_gen.py | ||
---|---|---|
177 | 177 |
if type_ != None: str_ += type_+' ' |
178 | 178 |
str_ += 'JOIN '+self.table.to_str(db)+' '+join_cond |
179 | 179 |
return str_ |
180 |
|
|
181 |
##### Old-style format support |
|
182 |
|
|
183 |
def unescape_table(table): |
|
184 |
'''Currently only works with PostgreSQL.''' |
|
185 |
if table == None: return table |
|
186 |
|
|
187 |
assert table.count('.') <= 1 |
|
188 |
parts = tuple((v.replace('"', '') for v in table.split('"."', 2))) |
|
189 |
if len(parts) == 1: parts, = parts |
|
190 |
return parts |
|
191 |
|
|
192 |
def table2sql_gen(table, table_is_esc=False): |
|
193 |
'''Converts old-style (tuple-based) tables to sql_gen-compatible values. |
|
194 |
@param table_is_esc If False, assumes any table name is not escaped or that |
|
195 |
re-escaping it will produce the same value. |
|
196 |
''' |
|
197 |
if util.is_str(table) and table_is_esc: table = unescape_table(table) |
|
198 |
return as_Table(table) |
Also available in: Unified diff
sql_gen.py: Removed no longer used unescape_table() and table2sql_gen()