mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-06 10:24:21 +01:00
add transactions and locking for certain operations (#217)
This commit is contained in:
@@ -48,6 +48,15 @@ class Compat:
|
||||
elif self.type == SQLITE:
|
||||
return ""
|
||||
return "<nothing>"
|
||||
|
||||
def lock_table(self, table: str) -> str:
|
||||
if self.type == POSTGRES:
|
||||
return f"LOCK TABLE {table} IN EXCLUSIVE MODE;"
|
||||
elif self.type == COCKROACH:
|
||||
return f"LOCK TABLE {table};"
|
||||
elif self.type == SQLITE:
|
||||
return "BEGIN EXCLUSIVE TRANSACTION;"
|
||||
return "<nothing>"
|
||||
|
||||
|
||||
class Connection(Compat):
|
||||
|
||||
Reference in New Issue
Block a user