diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-24 14:37:10 +0200 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2008-07-24 14:37:10 +0200 |
commit | 1d9a9b267d06973ae0ba1a0d65225afe00d17fbf (patch) | |
tree | ab0779140d89f7d93ca22523d18dcddc7d092eee /adbh.py | |
parent | 1a4dcdc0f6b17410c97511f85cdc9211360f2825 (diff) | |
download | logilab-common-1d9a9b267d06973ae0ba1a0d65225afe00d17fbf.tar.gz |
[adbh] provide support for different backend names for a single function description
Diffstat (limited to 'adbh.py')
-rw-r--r-- | adbh.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -37,6 +37,8 @@ class FunctionDescr(object): minargs = 1 maxargs = 1 + name_mapping = {} + def __init__(self, name=None, rtype=rtype, aggregat=aggregat): if name is not None: name = name.upper() @@ -44,6 +46,13 @@ class FunctionDescr(object): self.rtype = rtype self.aggregat = aggregat + def backend_name(self, backend): + try: + return self.name_mapping[backend] + except KeyError: + return self.name + backend_name = classmethod(backend_name) + #@classmethod def check_nbargs(cls, nbargs): if cls.minargs is not None and \ @@ -154,6 +163,10 @@ class _GenericAdvFuncHelper: return self.groups_support support_user = obsolete('use groups_support attribute')(support_groups) + def func_sqlname(self, funcname): + funcdef = self.function_description(funcname) + return funcdef.backend_name(self.backend_name) + def system_database(self): """return the system database for the given driver""" raise NotImplementedError('not supported by this DBMS') |