common/__init__.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1370 c1cf86a66e30
child 1977 606923dff11b
equal deleted inserted replaced
1801:672acc730ce5 1802:d628defebc17
    13 from rql.utils import register_function, iter_funcnode_variables
    13 from rql.utils import register_function, iter_funcnode_variables
    14 
    14 
    15 class COMMA_JOIN(FunctionDescr):
    15 class COMMA_JOIN(FunctionDescr):
    16     supported_backends = ('postgres', 'sqlite',)
    16     supported_backends = ('postgres', 'sqlite',)
    17     rtype = 'String'
    17     rtype = 'String'
    18     
    18 
    19     @classmethod
    19     @classmethod
    20     def st_description(cls, funcnode):
    20     def st_description(cls, funcnode):
    21         return ', '.join(term.get_description()
    21         return ', '.join(term.get_description()
    22                          for term in iter_funcnode_variables(funcnode))
    22                          for term in iter_funcnode_variables(funcnode))
    23     
    23 
    24 register_function(COMMA_JOIN)  # XXX do not expose?
    24 register_function(COMMA_JOIN)  # XXX do not expose?
    25 
    25 
    26 
    26 
    27 class CONCAT_STRINGS(COMMA_JOIN):
    27 class CONCAT_STRINGS(COMMA_JOIN):
    28     aggregat = True
    28     aggregat = True
    29     
    29 
    30 register_function(CONCAT_STRINGS) # XXX bw compat
    30 register_function(CONCAT_STRINGS) # XXX bw compat
    31 
    31 
    32 class GROUP_CONCAT(CONCAT_STRINGS):
    32 class GROUP_CONCAT(CONCAT_STRINGS):
    33     supported_backends = ('mysql', 'postgres', 'sqlite',)
    33     supported_backends = ('mysql', 'postgres', 'sqlite',)
    34     
    34 
    35 register_function(GROUP_CONCAT)
    35 register_function(GROUP_CONCAT)
    36 
    36 
    37 
    37 
    38 class LIMIT_SIZE(FunctionDescr):
    38 class LIMIT_SIZE(FunctionDescr):
    39     supported_backends = ('postgres', 'sqlite',)
    39     supported_backends = ('postgres', 'sqlite',)
    40     rtype = 'String'
    40     rtype = 'String'
    41     
    41 
    42     @classmethod
    42     @classmethod
    43     def st_description(cls, funcnode):
    43     def st_description(cls, funcnode):
    44         return funcnode.children[0].get_description()
    44         return funcnode.children[0].get_description()
    45     
    45 
    46 register_function(LIMIT_SIZE)
    46 register_function(LIMIT_SIZE)
    47 
    47 
    48 
    48 
    49 class TEXT_LIMIT_SIZE(LIMIT_SIZE):
    49 class TEXT_LIMIT_SIZE(LIMIT_SIZE):
    50     supported_backends = ('mysql', 'postgres', 'sqlite',)
    50     supported_backends = ('mysql', 'postgres', 'sqlite',)
    51     
    51 
    52 register_function(TEXT_LIMIT_SIZE)
    52 register_function(TEXT_LIMIT_SIZE)