Project

General

Profile

« Previous | Next » 

Revision 3461

sql_gen.py: FunctionDef: Added support for parameters

View differences:

lib/sql_gen.py
449 449
#### Definitions
450 450

  
451 451
class FunctionDef(Code):
452
    def __init__(self, function, return_type, body, modifiers=None):
452
    def __init__(self, function, return_type, body, args=[], 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.args = args
460 461
        self.modifiers = modifiers
461 462
    
462 463
    def to_str(self, db):
463 464
        str_ = '''\
464
CREATE FUNCTION '''+self.function.to_str(db)+'''()
465
CREATE FUNCTION '''+self.function.to_str(db)+'''('''+(', '.join(self.args))+''')
465 466
RETURNS '''+self.return_type+'''
466 467
LANGUAGE '''+self.body.lang+'''
467 468
'''

Also available in: Unified diff