summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2010-03-09 10:38:29 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2010-03-09 10:38:29 +0100
commit8dd4d45de31cb7a519b6993bdc74f113fd8fe5a5 (patch)
tree8d161263e8a715ad0b64a17c6768b403b9d6c890
parent98f8214fac4027c4b82e257b99af702236893d1f (diff)
downloadlogilab-common-8dd4d45de31cb7a519b6993bdc74f113fd8fe5a5.tar.gz
fix backward compat for db/adbh
-rw-r--r--adbh.py10
-rw-r--r--db.py10
2 files changed, 17 insertions, 3 deletions
diff --git a/adbh.py b/adbh.py
index 53064c0..0e104ba 100644
--- a/adbh.py
+++ b/adbh.py
@@ -20,4 +20,12 @@ from warnings import warn
warn('this module is deprecated, use logilab.db instead',
DeprecationWarning, stacklevel=1)
-from logilab.db import FunctionDescr, get_db_helper as get_adv_func_helper
+from logilab.db import (FunctionDescr, get_db_helper as get_adv_func_helper,
+ _GenericAdvFuncHelper,
+ _ADV_FUNC_HELPER_DIRECTORY as ADV_FUNC_HELPER_DIRECTORY)
+from logilab.common.decorators import monkeypatch
+
+@monkeypatch(_GenericAdvFuncHelper)
+def func_sqlname(self, funcname):
+ funcdef = self.function_description(funcname)
+ return funcdef.name_mapping.get(self.backend_name, funcname)
diff --git a/db.py b/db.py
index 2456292..03d7cff 100644
--- a/db.py
+++ b/db.py
@@ -26,5 +26,11 @@ from warnings import warn
warn('this module is deprecated, use logilab.db instead',
DeprecationWarning, stacklevel=1)
-from logilab.common.db import (get_connection, set_prefered_driver,
- get_dbapi_compliant_module)
+from logilab.db import (get_connection, set_prefered_driver,
+ get_dbapi_compliant_module as _gdcm,
+ get_db_helper as _gdh)
+
+def get_dbapi_compliant_module(driver, *args, **kwargs):
+ module = _gdcm(driver, *args, **kwargs)
+ module.adv_func_helper = _gdh(driver)
+ return module