diff options
| author | Christophe Simonis <chs@openerp.com> | 2010-09-03 09:41:32 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2010-09-03 09:41:32 +0200 |
| commit | 7cf31b4869e49efa4013ddbcdf837ab94a739cf8 (patch) | |
| tree | 60cf6ea64664d872ca0bec690771898f9c04cfeb /bin/sql_db.py | |
| parent | 827ce83b5767611573e3e504cd882f1684b5bd2a (diff) | |
[IMP] display database name in the logger
bzr revid: chs@openerp.com-20100903074132-nrhd3p2i53hmtt9j
Diffstat (limited to 'bin/sql_db.py')
| -rw-r--r-- | bin/sql_db.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py index 5ed7b14c0df..76a9e6f5f7c 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -21,6 +21,7 @@ __all__ = ['db_connect', 'close_db'] +from threading import current_thread import logging from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_SERIALIZABLE from psycopg2.psycopg1 import cursor as psycopg1cursor @@ -362,11 +363,15 @@ def dsn_are_equals(first, second): _Pool = ConnectionPool(int(tools.config['db_maxconn'])) def db_connect(db_name): + current_thread().dbname = db_name return Connection(_Pool, db_name) def close_db(db_name): _Pool.close_all(dsn(db_name)) tools.cache.clean_caches_for_db(db_name) + ct = current_thread() + if hasattr(ct, 'dbname'): + delattr(ct, 'dbname') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
