summaryrefslogtreecommitdiff
path: root/adbh.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-24 14:37:10 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-24 14:37:10 +0200
commit1d9a9b267d06973ae0ba1a0d65225afe00d17fbf (patch)
treeab0779140d89f7d93ca22523d18dcddc7d092eee /adbh.py
parent1a4dcdc0f6b17410c97511f85cdc9211360f2825 (diff)
downloadlogilab-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.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/adbh.py b/adbh.py
index 67259d6..34756dc 100644
--- a/adbh.py
+++ b/adbh.py
@@ -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')