diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-24 18:05:40 +0200 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-24 18:05:40 +0200 |
commit | da452d3ec2f0673cdcedba88f4c2927b0fe02749 (patch) | |
tree | 259b0c69bdbb7a766d38dc1ef39473f7f63744d0 /adbh.py | |
parent | 1d9a9b267d06973ae0ba1a0d65225afe00d17fbf (diff) | |
download | logilab-common-da452d3ec2f0673cdcedba88f4c2927b0fe02749.tar.gz |
[adbh] define the RANDOM function
Diffstat (limited to 'adbh.py')
-rw-r--r-- | adbh.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -88,6 +88,14 @@ class LENGTH(FunctionDescr): class DATE(FunctionDescr): rtype = 'Date' +class RANDOM(FunctionDescr): + supported_backends = ('postgres', 'mysql',) + rtype = 'Float' + minargs = maxargs = 0 + name_mapping = {'postgres': 'RANDOM', + 'mysql': 'RAND', + } + class _GenericAdvFuncHelper: """Generic helper, trying to provide generic way to implement specific functionnalities from others DBMS @@ -113,6 +121,7 @@ class _GenericAdvFuncHelper: 'UPPER': UPPER, 'LOWER': LOWER, 'LENGTH': LENGTH, 'DATE': DATE, + 'RANDOM': RANDOM, # keyword function 'IN': IN } @@ -405,7 +414,8 @@ class _SqliteAdvFuncHelper(_GenericAdvFuncHelper): backend_name = 'sqlite' # modifiable but should not be shared FUNCTIONS = _GenericAdvFuncHelper.FUNCTIONS.copy() - + FUNCTIONS.pop('RANDOM') # not defined in sqlite + users_support = groups_support = False ilike_support = False union_parentheses_support = False |