Esempio n. 1
0
 def __init__(self, dbfile, read_only=False):
     dbconn = sqlite3.connect(dbfile)
     dberror = sqlite3.Error
     Connection.__init__(
         self, dbconn, dberror,
         DIALECT_SQLITE, "?",
         read_only
         )
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     _import_psycopg2()
     read_only = kwargs.pop('read_only', None)
     isolation_level = kwargs.pop('isolation_level', REPEATABLE_READ)
     assert isolation_level in _VALID_ISOLATION_LEVELS, \
         ("Unknown isolation_level", isolation_level)
     #
     pg_isolation_level = _ISOLATION_LEVEL_MAP[isolation_level]
     #
     dbconn = psycopg2.connect(*args, **kwargs)
     dbconn.set_session(pg_isolation_level)
     dberror = psycopg2.Error
     Connection.__init__(
         self, dbconn, dberror,
         DIALECT_POSTGRES, "%s",
         read_only
         )
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     import MySQLdb
     read_only = kwargs.pop('read_only', None)
     isolation_level = kwargs.pop('isolation_level', REPEATABLE_READ)
     assert isolation_level in _VALID_ISOLATION_LEVELS, \
         ("Unknown isolation_level", isolation_level)
     #
     assert not 'charset' in kwargs
     kwargs['charset'] = 'utf8'
     assert not 'use_unicode' in kwargs
     kwargs['use_unicode'] = True
     #
     dbconn = MySQLdb.connect(*args, **kwargs)
     dberror = MySQLdb.Error
     Connection.__init__(
         self, dbconn, dberror,
         DIALECT_MYSQL, "%s",
         read_only
         )
     isolation_sql = _ISOLATION_SQL % isolation_level
     self._execute(isolation_sql)