Revision 3515
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
573 | 573 |
def to_str(self, db): |
574 | 574 |
return 'RETURN QUERY\n'+strings.indent(self.query.to_str(db))+';\n' |
575 | 575 |
|
576 |
## Exceptions |
|
577 |
|
|
576 | 578 |
class BaseExcHandler(BasicObject): |
577 | 579 |
def to_str(self, db, body): raise NotImplementedError() |
578 | 580 |
|
... | ... | |
601 | 603 |
''' |
602 | 604 |
return str_ |
603 | 605 |
|
606 |
class NestedExcHandler(BaseExcHandler): |
|
607 |
def __init__(self, *handlers): |
|
608 |
''' |
|
609 |
@param handlers Sorted from outermost to innermost |
|
610 |
''' |
|
611 |
self.handlers = handlers |
|
612 |
|
|
613 |
def to_str(self, db, body): |
|
614 |
for handler in reversed(self.handlers): body = handler.to_str(db, body) |
|
615 |
return body |
|
616 |
|
|
604 | 617 |
class ExcToWarning(Code): |
605 | 618 |
def __init__(self, return_): |
606 | 619 |
''' |
Also available in: Unified diff
sql_gen.py: Added NestedExcHandler