Revision 5765
Added by Aaron Marcuse-Kubitza about 12 years ago
sql.py | ||
---|---|---|
1350 | 1350 |
', '.join((v.to_str(db) for v in exprs)))+')' |
1351 | 1351 |
run_query(db, str_, recover=True, cacheable=True, log_level=3) |
1352 | 1352 |
|
1353 |
def add_pkey_or_index(db, table, cols=None, recover=None, warn=False): |
|
1354 |
try: add_pkey(db, table, cols, recover) |
|
1355 |
except DuplicateKeyException, e: |
|
1356 |
if warn: warnings.warn(UserWarning(exc.str_(e))) |
|
1357 |
add_index(db, pkey_col(db, table), table) |
|
1358 |
|
|
1353 | 1359 |
already_indexed = object() # tells add_indexes() the pkey has already been added |
1354 | 1360 |
|
1355 | 1361 |
def add_indexes(db, table, has_pkey=True): |
Also available in: Unified diff
sql.py: Added add_pkey_or_index()