我在内存模式下使用我的程序运行sqlite v3.7.17并使用共享缓存(如
Shared Cache And In-Memory Databases中所指定).我的程序是多线程的,所有这些线程都访问相同的内存数据库.
有没有什么方法可以配置或使用我的sqlite数据库,这样当两个线程在同一个表(但不同的行)上运行更新查询时,一个不等待另一个?也就是说,如何在内存数据库中实现行级锁定?
决定sqlite是否可以锁定行的不是文件系统.这是sqlite的架构.
甚至使用预写日志记录,you can only have one writer at a time.
Writers merely append new content to the end of the WAL file. Because
writers do nothing that would interfere with the actions of readers,
writers and readers can run at the same time. However,since there is
only one WAL file,there can only be one writer at a time.