Skip to content
Snippets Groups Projects
Commit 5f66e671 authored by Simon Künzel's avatar Simon Künzel
Browse files

Fix a return type

parent 103d37d1
No related branches found
No related tags found
1 merge request!7Allow different transaction isolation levels in db and some misc changes
Pipeline #6097 passed
...@@ -59,7 +59,7 @@ class _MySqlDbConnection(PythonDbConnection[MySQLConnection, MySQLCursor]): ...@@ -59,7 +59,7 @@ class _MySqlDbConnection(PythonDbConnection[MySQLConnection, MySQLCursor]):
self._closed = True self._closed = True
self._py_connection.close() self._py_connection.close()
def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> PreparedStatement or str: def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> list[PreparedStatement or str]:
if writable: if writable:
return [ return [
f"SET SESSION TRANSACTION ISOLATION LEVEL {isolation_level.value}", f"SET SESSION TRANSACTION ISOLATION LEVEL {isolation_level.value}",
......
...@@ -90,7 +90,7 @@ source_function: {diagnostic.source_function} ...@@ -90,7 +90,7 @@ source_function: {diagnostic.source_function}
self._closed = True self._closed = True
self._py_connection.close() self._py_connection.close()
def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> PreparedStatement or str: def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> list[PreparedStatement or str]:
if writable: if writable:
return [f"START TRANSACTION ISOLATION LEVEL {isolation_level.value}, READ WRITE"] return [f"START TRANSACTION ISOLATION LEVEL {isolation_level.value}, READ WRITE"]
else: else:
......
...@@ -62,7 +62,7 @@ class SqLiteDbConnection(PythonDbConnection[Connection, Cursor]): ...@@ -62,7 +62,7 @@ class SqLiteDbConnection(PythonDbConnection[Connection, Cursor]):
self._closed = True self._closed = True
self._py_connection.close() self._py_connection.close()
def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> PreparedStatement or str: def get_transaction_begin_statements(self, writable: bool, isolation_level: TransactionIsolationLevel) -> list[PreparedStatement or str]:
return ["BEGIN DEFERRED TRANSACTION"] # Transactions in SQLite are serializable by default return ["BEGIN DEFERRED TRANSACTION"] # Transactions in SQLite are serializable by default
def get_transaction_end_statement(self, commit: bool) -> PreparedStatement or str: def get_transaction_end_statement(self, commit: bool) -> PreparedStatement or str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment