diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-10-01 00:06:52 -0400 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-10-01 00:06:52 -0400 |
| commit | 5819a29bf653262f9c3c70b1cf56a10526a5fbf0 (patch) | |
| tree | 4ee713ffe9ab58e232979f506a877aeebfc8b271 | |
| parent | 5261442c30c713120ee84da8bc9114494e7151cf (diff) | |
| download | pypaste-5819a29bf653262f9c3c70b1cf56a10526a5fbf0.tar.gz | |
make use of transactions
| -rw-r--r-- | pypaste/server/sqlite/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pypaste/server/sqlite/__init__.py b/pypaste/server/sqlite/__init__.py index 3d5e1b1..5cd00a6 100644 --- a/pypaste/server/sqlite/__init__.py +++ b/pypaste/server/sqlite/__init__.py @@ -29,6 +29,8 @@ class Sqlite(Storage): data = await asyncio.to_thread(compress) try: + await self.connection.execute("begin") + await self.connection.execute( "insert into pastes values(?, ?, ?, ?, ?)", ( @@ -95,6 +97,8 @@ class Sqlite(Storage): async def delete(self, key: Key) -> None: try: + await self.connection.execute("begin") + await self.connection.execute("delete from pastes where key=?", (key.data,)) await self.connection.execute( |
