summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Di Mascio <adim@logilab.fr>2006-05-15 15:09:45 +0200
committerAdrien Di Mascio <adim@logilab.fr>2006-05-15 15:09:45 +0200
commitd5eccd938adafa6b8ae0fabf017cfc220527ee08 (patch)
tree6481dadf24be02c301cdecd91d54184231e29759
parent178ba3b2e9a1cadad0bd2f9bbaf1de796d9b369e (diff)
downloadlogilab-common-d5eccd938adafa6b8ae0fabf017cfc220527ee08.tar.gz
simple psycopg2 adapter (will have to improve that later)
-rw-r--r--db.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/db.py b/db.py
index 0aa0ac1..dad8ed9 100644
--- a/db.py
+++ b/db.py
@@ -195,6 +195,11 @@ class _PsycopgAdapter(DBAPIAdapter):
return self._wrap_if_needed(cnx)
+class _Psycopg2Adapter(_PsycopgAdapter):
+ """Simple Psycopg2 Adapter to DBAPI (cnx_string differs from classical ones)
+ """
+ BOOLEAN = 16 # XXX
+
class _PgsqlAdapter(DBAPIAdapter):
"""Simple pyPgSQL Adapter to DBAPI
@@ -425,7 +430,7 @@ class _SqliteAdvFuncHelper(_GenericAdvFuncHelper):
PREFERED_DRIVERS = {
- "postgres" : [ 'psycopg', 'pgdb', 'pyPgSQL.PgSQL', ],
+ "postgres" : [ 'psycopg', 'psycopg2', 'pgdb', 'pyPgSQL.PgSQL', ],
"mysql" : [ 'MySQLdb', ], # 'pyMySQL.MySQL, ],
"sqlite" : [ 'pysqlite2.dbapi2', 'sqlite', ],
}
@@ -433,6 +438,7 @@ PREFERED_DRIVERS = {
_ADAPTERS = {
'postgres' : { 'pgdb' : _PgdbAdapter,
'psycopg' : _PsycopgAdapter,
+ 'psycopg2' : _Psycopg2Adapter,
'pyPgSQL.PgSQL' : _PgsqlAdapter,
},
'mysql' : { 'MySQLdb' : _MySqlDBAdapter, },