Project

General

Profile

« Previous | Next » 

Revision 3503

sql_gen.py: Added ExcToWarning

View differences:

lib/sql_gen.py
591 591
    
592 592
    def __repr__(self): return self.to_str(mockDb, '<body>')
593 593

  
594
class ExcToWarning(Code):
595
    def __init__(self, return_):
596
        '''
597
        @param return_ Statement to return a default value in case of error
598
        '''
599
        Code.__init__(self)
600
        
601
        return_ = as_Code(return_)
602
        
603
        self.return_ = return_
604
    
605
    def to_str(self, db):
606
        return "RAISE WARNING '%', SQLERRM;\n"+self.return_.to_str(db)
607

  
594 608
unique_violation_handler = ExcHandler('unique_violation')
595 609

  
596 610
plpythonu_error_handler = ExcHandler('internal_error', '''\

Also available in: Unified diff