Project

General

Profile

« Previous | Next » 

Revision 5337

sql.py: Renamed table_cols() to table_col_names() for clarity, because it does not return sql_gen.Col objects

View differences:

sql.py
1086 1086
    return value(run_query(db, mk_select(db, table, [sql_gen.row_count],
1087 1087
        order_by=None), recover=recover, log_level=3))
1088 1088

  
1089
def table_cols(db, table, recover=None):
1089
def table_col_names(db, table, recover=None):
1090 1090
    return list(col_names(select(db, table, limit=0, order_by=None,
1091 1091
        recover=recover, log_level=4)))
1092 1092

  
......
1110 1110
    
1111 1111
    try: return value(select(db, tables, cols, conds, order_by=order_by,
1112 1112
        limit=1, log_level=4))
1113
    except StopIteration: return table_cols(db, table, recover)[0]
1113
    except StopIteration: return table_col_names(db, table, recover)[0]
1114 1114

  
1115 1115
def pkey_col_(db, table, *args, **kw_args):
1116 1116
    return sql_gen.Col(pkey(db, table, *args, **kw_args), table)
......
1119 1119

  
1120 1120
def table_not_null_col(db, table, recover=None):
1121 1121
    '''Name assumed to be the value of not_null_col. If not found, uses pkey.'''
1122
    if not_null_col in table_cols(db, table, recover): return not_null_col
1122
    if not_null_col in table_col_names(db, table, recover): return not_null_col
1123 1123
    else: return pkey(db, table, recover)
1124 1124

  
1125 1125
def constraint_cond(db, constraint):
......
1288 1288
        index should be added on the first column.
1289 1289
        * If already_indexed, the pkey is assumed to have already been added
1290 1290
    '''
1291
    cols = table_cols(db, table)
1291
    cols = table_col_names(db, table)
1292 1292
    if has_pkey:
1293 1293
        if has_pkey is not already_indexed: add_pkey(db, table)
1294 1294
        cols = cols[1:]

Also available in: Unified diff