是否有任何支持多线程的本地DB? [英] Are there any local DB that support multi-threading?
问题描述
我试过sqlite,
通过使用多线程,只有一个线程可以同时更新db。
我需要多线程更新db同时。
有没有任何DB可以做的工作?
I tried sqlite, by using multi-thread, only one thread can update db at the same time.. I need multi-thread updating the db at same time. Is there are any DB can do the job?
ps:我使用delphi6。
ps: I use delphi6.
sqlite可以支持多线程,
I found that sqlite can support multi-threading,
但是在我的asgsqlite测试中,当一个线程插入,其他人将无法插入。
But in my test of asgsqlite, when one thread inserting, others will fail to insert.
我仍在测试。
推荐答案
更新时,Sqlite锁定整个数据库我最后使用它)。第二个线程不能同时更新数据库(即使使用完全独立的表)。但是,有一个超时参数告诉第二个线程在失败之前重试x毫秒。我认为ASqlite在数据库组件中面向这个参数(我认为我实际上写了这一段代码,所有3行,但它是一个几年前)。
Sqlite locks the entire database when updating (unless this has changed since I last used it). A second thread cannot update the database at the same time (even using entirely separate tables). However there is a timeout parameter that tells the second thread to retry for x milliseconds before failing. I think ASqlite surfaces this parameter in the database component (I think I actually wrote that bit of code, all 3 lines, but it was a couple of years ago).
将超时设置为大于0的值将允许多个线程更新数据库。但是可能会有性能影响。
Setting the timeout to a larger value than 0 will allow multiple threads to update the database. However there may be performance implications.
这篇关于是否有任何支持多线程的本地DB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!