Project

General

Profile

« Previous | Next » 

Revision 2340

sql.py: Added table_not_null_col()

View differences:

lib/sql.py
607 607
    '''Assumed to be first column in table'''
608 608
    return table_cols(db, table, recover)[0]
609 609

  
610
not_null_col = 'not_null'
611

  
612
def table_not_null_col(db, table, recover=None):
613
    '''Name assumed to be the value of not_null_col. If not found, uses pkey.'''
614
    if not_null_col in table_cols(db, table, recover): return not_null_col
615
    else: return pkey(db, table, recover)
616

  
610 617
def index_cols(db, table, index):
611 618
    '''Can also use this for UNIQUE constraints, because a UNIQUE index is
612 619
    automatically created. When you don't know whether something is a UNIQUE

Also available in: Unified diff