Revision 3490
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
939 | 939 |
elif module == 'MySQLdb': return db.insert_id() |
940 | 940 |
else: return None |
941 | 941 |
|
942 |
def define_func(db, def_): |
|
943 |
func = def_.function |
|
944 |
while True: |
|
945 |
try: |
|
946 |
run_query(db, def_.to_str(db), recover=True, cacheable=True, |
|
947 |
log_ignore_excs=(DuplicateException,)) |
|
948 |
break # successful |
|
949 |
except DuplicateException: |
|
950 |
func.name = sql.next_version(func.name) |
|
951 |
# try again with next version of name |
|
952 |
|
|
942 | 953 |
def mk_flatten_mapping(db, into, cols, preserve=[], as_items=False): |
943 | 954 |
'''Creates a mapping from original column names (which may have collisions) |
944 | 955 |
to names that will be distinct among the columns' tables. |
Also available in: Unified diff
sql.py: Added define_func()