Project

General

Profile

« Previous | Next » 

Revision 2916

sql.py: Use new DbConn.debug_temp config option to control whether temporary objects should instead be permanent

View differences:

sql.py
154 154
        @param debug_temp Whether temporary objects should instead be permanent.
155 155
            This assists in debugging the internal objects used by the program.
156 156
        '''
157
        if debug_temp: autocommit = True
158
        
157 159
        self.db_config = db_config
158 160
        self.autocommit = autocommit
159 161
        self.caching = caching
......
482 484
    kw_args['recover'] = True
483 485
    kw_args.setdefault('log_ignore_excs', (DuplicateTableException,))
484 486
    
485
    temp = not db.autocommit # tables are permanent in autocommit mode
487
    temp = not db.debug_temp # tables are permanent in debug_temp mode
486 488
    # "temporary tables cannot specify a schema name", so remove schema
487 489
    if temp: into.schema = None
488 490
    
......
630 632
        return_type = 'SETOF '+returning.to_str(db)+'%TYPE'
631 633
        while True:
632 634
            try:
633
                function = sql_gen.TempFunction(function_name, db.autocommit)
635
                function = sql_gen.TempFunction(function_name, db.debug_temp)
634 636
                
635 637
                function_query = '''\
636 638
CREATE FUNCTION '''+function.to_str(db)+'''()
......
801 803
    errors_table = sql_gen.as_Table(errors_table)
802 804
    srcs = map(sql_gen.to_name_only_col, col.srcs)
803 805
    function_name = str(sql_gen.FunctionCall(type_, *srcs))
804
    function = sql_gen.TempFunction(function_name, db.autocommit)
806
    function = sql_gen.TempFunction(function_name, db.debug_temp)
805 807
    
806 808
    while True:
807 809
        # Create function definition

Also available in: Unified diff