File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -692,8 +692,8 @@ def supports_strict(self) -> bool:
692692 def supports_on_conflict (self ) -> bool :
693693 # SQLite's upsert is implemented as INSERT INTO ... ON CONFLICT DO ...
694694 if not hasattr (self , "_supports_on_conflict" ):
695+ table_name = "t{}" .format (secrets .token_hex (16 ))
695696 try :
696- table_name = "t{}" .format (secrets .token_hex (16 ))
697697 with self .conn :
698698 self .conn .execute (
699699 "create table {} (id integer primary key, name text)" .format (
@@ -709,10 +709,11 @@ def supports_on_conflict(self) -> bool:
709709 "on conflict do update set name = 'two'"
710710 ).format (table_name )
711711 )
712- self .conn .execute ("drop table {}" .format (table_name ))
713- self ._supports_on_conflict = True
712+ self ._supports_on_conflict = True
714713 except Exception :
715714 self ._supports_on_conflict = False
715+ finally :
716+ self .conn .execute ("drop table {}" .format (table_name ))
716717 return self ._supports_on_conflict
717718
718719 @property
You can’t perform that action at this time.
0 commit comments