Revision 3456
Added by Aaron Marcuse-Kubitza over 12 years ago
sql_gen.py | ||
---|---|---|
449 | 449 |
#### Definitions |
450 | 450 |
|
451 | 451 |
class FunctionDef(Code): |
452 |
def __init__(self, function, return_type, body): |
|
452 |
def __init__(self, function, return_type, body, modifiers=None):
|
|
453 | 453 |
Code.__init__(self) |
454 | 454 |
|
455 | 455 |
body = as_Code(body) |
... | ... | |
457 | 457 |
self.function = function |
458 | 458 |
self.return_type = return_type |
459 | 459 |
self.body = body |
460 |
self.modifiers = modifiers |
|
460 | 461 |
|
461 | 462 |
def to_str(self, db): |
462 | 463 |
str_ = '''\ |
463 | 464 |
CREATE FUNCTION '''+self.function.to_str(db)+'''() |
464 | 465 |
RETURNS '''+self.return_type+''' |
465 | 466 |
LANGUAGE '''+self.body.lang+''' |
467 |
''' |
|
468 |
if self.modifiers != None: str_ += self.modifiers+'\n' |
|
469 |
str_ += '''\ |
|
466 | 470 |
AS $$ |
467 | 471 |
'''+self.body.to_str(db)+''' |
468 | 472 |
$$; |
Also available in: Unified diff
sql_gen.py: FunctionDef: Support custom function modifiers