Revision 5392
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
1072 | 1072 |
|
1073 | 1073 |
def pkey_name(db, table, recover=None): |
1074 | 1074 |
'''If no pkey, returns the first column in the table.''' |
1075 |
try: return table_pkey_col(db, table, recover).name |
|
1076 |
except StopIteration: return table_col_names(db, table, recover)[0] |
|
1075 |
return pkey_col(db, table, recover).name |
|
1077 | 1076 |
|
1078 | 1077 |
def pkey_col(db, table, recover=None): |
1079 | 1078 |
'''If no pkey, returns the first column in the table.''' |
1080 |
return sql_gen.Col(pkey_name(db, table, recover), table) |
|
1079 |
try: return table_pkey_col(db, table, recover) |
|
1080 |
except StopIteration: return table_cols(db, table, recover)[0] |
|
1081 | 1081 |
|
1082 | 1082 |
not_null_col = 'not_null_col' |
1083 | 1083 |
|
Also available in: Unified diff
sql.py: pkey_col(): Call table_pkey_col() directly rather than via pkey_name(). pkey_name(): Call pkey_col() instead of table_pkey_col() now that pkey_col() calls table_pkey_col().