parent
d5031ecf88
commit
3becac8484
|
@ -488,7 +488,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
self.connection.autocommit(autocommit)
|
with self.wrap_database_errors:
|
||||||
|
self.connection.autocommit(autocommit)
|
||||||
|
|
||||||
def disable_constraint_checking(self):
|
def disable_constraint_checking(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -687,7 +687,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
self.connection.autocommit = autocommit
|
with self.wrap_database_errors:
|
||||||
|
self.connection.autocommit = autocommit
|
||||||
|
|
||||||
def check_constraints(self, table_names=None):
|
def check_constraints(self, table_names=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -189,14 +189,15 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
self.connection.set_isolation_level(isolation_level)
|
self.connection.set_isolation_level(isolation_level)
|
||||||
|
|
||||||
def _set_autocommit(self, autocommit):
|
def _set_autocommit(self, autocommit):
|
||||||
if self.psycopg2_version >= (2, 4, 2):
|
with self.wrap_database_errors:
|
||||||
self.connection.autocommit = autocommit
|
if self.psycopg2_version >= (2, 4, 2):
|
||||||
else:
|
self.connection.autocommit = autocommit
|
||||||
if autocommit:
|
|
||||||
level = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
|
|
||||||
else:
|
else:
|
||||||
level = self.isolation_level
|
if autocommit:
|
||||||
self.connection.set_isolation_level(level)
|
level = psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT
|
||||||
|
else:
|
||||||
|
level = self.isolation_level
|
||||||
|
self.connection.set_isolation_level(level)
|
||||||
|
|
||||||
def check_constraints(self, table_names=None):
|
def check_constraints(self, table_names=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -411,7 +411,8 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
level = ''
|
level = ''
|
||||||
# 'isolation_level' is a misleading API.
|
# 'isolation_level' is a misleading API.
|
||||||
# SQLite always runs at the SERIALIZABLE isolation level.
|
# SQLite always runs at the SERIALIZABLE isolation level.
|
||||||
self.connection.isolation_level = level
|
with self.wrap_database_errors:
|
||||||
|
self.connection.isolation_level = level
|
||||||
|
|
||||||
def check_constraints(self, table_names=None):
|
def check_constraints(self, table_names=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue