Cleanup for _start_transaction_under_autocommit
This commit is contained in:
1 parent
de52e55e34
commit
21e9cbef4b
1 file changed
+6
-7
@@ -5,15 +5,14 @@ class DatabaseWrapper(base.DatabaseWrapper):
|
||||
|
||||
def _start_transaction_under_autocommit(self):
|
||||
conn_params = self.get_connection_params()
|
||||
if "transaction_mode" not in conn_params:
|
||||
self.cursor().execute("BEGIN TRANSACTION")
|
||||
else:
|
||||
tm = str(conn_params["transaction_mode"]).upper().strip()
|
||||
transaction_modes = frozenset(["DEFERRED", "EXCLUSIVE", "IMMEDIATE"])
|
||||
|
||||
sql_statement = "BEGIN TRANSACTION"
|
||||
if "transaction_mode" in conn_params:
|
||||
tm = str(conn_params["transaction_mode"]).upper().strip()
|
||||
if tm in transaction_modes:
|
||||
self.cursor().execute(f"BEGIN {tm} TRANSACTION")
|
||||
else:
|
||||
self.cursor().execute("BEGIN TRANSACTION")
|
||||
sql_statement = f"BEGIN {tm} TRANSACTION"
|
||||
self.cursor().execute(sql_statement)
|
||||
|
||||
|
||||
def init_connection_state(self):
|
||||
|
||||
Reference in new issue
Block a user