SQLite不存在线程安全吗?

SQLite不存在线程安全吗?,sqlite,concurrency,Sqlite,Concurrency,如果列url在SQLite上有一个唯一的约束,并且这个约束是并发执行的,那么这会引发约束冲突错误吗?表示两个或多个线程同时运行完全相同的插入 insert into urls(url) select 'https://www.test.com' where not exists(select * from urls where url = 'https://www.test.com'); 是的,SQLite将正确地实施唯一约束,即使在面临并发更新时也是如此。因此,其中一个事务在同一时间执行

如果列url在SQLite上有一个唯一的约束,并且这个约束是并发执行的,那么这会引发约束冲突错误吗?表示两个或多个线程同时运行完全相同的插入

insert into urls(url) 
select 'https://www.test.com' 
where not exists(select * from urls where url = 'https://www.test.com');

是的,SQLite将正确地实施唯一约束,即使在面临并发更新时也是如此。因此,其中一个事务在同一时间执行时可能会失败

insert into urls(url) 
select 'https://www.test.com' 
where not exists(select * from urls where url = 'https://www.test.com');