Revision 5990
Added by Aaron Marcuse-Kubitza about 12 years ago
sql.py | ||
---|---|---|
1136 | 1136 |
order_by=order_by, limit=1, log_level=4)), table) |
1137 | 1137 |
except StopIteration: raise DoesNotExistException('primary key', '') |
1138 | 1138 |
|
1139 |
def table_has_pkey(db, table, recover=None): |
|
1140 |
try: table_pkey_col(db, table, recover) |
|
1141 |
except DoesNotExistException: return False |
|
1142 |
else: return True |
|
1143 |
|
|
1139 | 1144 |
def pkey_name(db, table, recover=None): |
1140 | 1145 |
'''If no pkey, returns the first column in the table.''' |
1141 | 1146 |
return pkey_col(db, table, recover).name |
Also available in: Unified diff
sql.py: Added table_has_pkey()