Project

General

Profile

« Previous | Next » 

Revision 2593

sql.py: into_table_name(): In function args, omit column name for function result columns

View differences:

lib/sql.py
872 872
        if not create: raise
873 873
        return put(db, table, row, pkey, row_ct_ref) # insert new row
874 874

  
875
def is_func_result(col):
876
    return col.table.name.find('(') >= 0 and col.name == 'result'
877

  
875 878
def into_table_name(out_table, in_tables0, mapping, is_func):
876 879
    str_ = str(out_table)
877 880
    if is_func:
878
        def is_in_table_col(col):
879
            return isinstance(col, sql_gen.Col) and col.table == in_tables0
880 881
        def col(out_col, in_col):
881 882
            # Add out_col
882 883
            out_col = sql_gen.to_name_only_col(out_col)
......
885 886
            
886 887
            # Add in_col
887 888
            in_col = sql_gen.remove_col_rename(in_col)
888
            if is_in_table_col(in_col):
889
                in_col = sql_gen.to_name_only_col(in_col)
889
            if isinstance(in_col, sql_gen.Col):
890
                table = in_col.table
891
                if table == in_tables0:
892
                    in_col = sql_gen.to_name_only_col(in_col)
893
                elif is_func_result(in_col): in_col = table # omit col name
890 894
            str_ += str(in_col)
891 895
            
892 896
            return str_

Also available in: Unified diff