Project

General

Profile

« Previous | Next » 

Revision 3444

sql_gen.py: FunctionDef: body param: Support Code inputs in addition to strings

View differences:

lib/sql_gen.py
432 432

  
433 433
class FunctionDef(Code):
434 434
    def __init__(self, function, return_type, body, lang='sql'):
435
        body = as_Code(body)
436
        
435 437
        self.function = function
436 438
        self.return_type = return_type
437 439
        self.body = body
......
443 445
RETURNS SETOF '''+self.return_type+'''
444 446
LANGUAGE '''+self.lang+'''
445 447
AS $$
446
'''+self.body+'''
448
'''+self.body.to_str(db)+'''
447 449
$$;
448 450
'''
449 451
        return str_

Also available in: Unified diff