Revision 3153
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
811 | 811 |
return insert_select(db, table, cols, query, *args, **kw_args) |
812 | 812 |
|
813 | 813 |
def mk_update(db, table, changes=None, cond=None, in_place=False, |
814 |
cacheable=True): |
|
814 |
cacheable_=True):
|
|
815 | 815 |
''' |
816 | 816 |
@param changes [(col, new_value),...] |
817 | 817 |
* container can be any iterable type |
... | ... | |
821 | 821 |
@param in_place If set, locks the table and updates rows in place. |
822 | 822 |
This avoids creating dead rows in PostgreSQL. |
823 | 823 |
* cond must be None |
824 |
@param cacheable Whether column structure information used to generate the |
|
824 |
@param cacheable_ Whether column structure information used to generate the
|
|
825 | 825 |
query can be cached |
826 | 826 |
@return str query |
827 | 827 |
''' |
... | ... | |
834 | 834 |
|
835 | 835 |
query = 'ALTER TABLE '+table.to_str(db)+'\n' |
836 | 836 |
query += ',\n'.join(('ALTER COLUMN '+c.to_str(db)+' TYPE ' |
837 |
+db.col_info(sql_gen.with_default_table(c, table), cacheable).type |
|
837 |
+db.col_info(sql_gen.with_default_table(c, table), cacheable_).type
|
|
838 | 838 |
+'\nUSING '+v.to_str(db) for c, v in changes)) |
839 | 839 |
else: |
840 | 840 |
query = 'UPDATE '+table.to_str(db)+'\nSET\n' |
Also available in: Unified diff
sql.py: mk_update(): Renamed cacheable param to cacheable_ so it wouldn't conflict with update()'s cacheable param