Using SQLite as a multi-user database?

Bob Sneidar bobs at twft.com
Tue Nov 23 11:54:38 EST 2010


I think you could simply use the try/catch structure. Try yo open the database for writing, then exit if all goes well. If not, in your catch, just loop. Increment a counter, so that you can break out of the loop at an inordinate number of attempts to avoid loop lock. Then you just have to make sure that there is no user interaction while the database is open. Get in, get what you want, and get out. 

Bob


On Nov 23, 2010, at 7:42 AM, Fredrik Andersson wrote:

> Thanks for the suggestions, I wouldn't have though of that! Unfortunately I don't think I could run any kind of serverlike program on our network. 
> 
> I'm actually contemplating using some kind of lock-file that is created whenever someone is writing to the database (or perhaps I'll even use some plain text files for simplicity) and deleted when the writing is finished. Then the client simply checks for the existence of a lock file before trying to write. There will only be a handful of people writing and possibly a couple of hundred people reading so it might work, even if it's not very elegant. Anyway, I'll start by doing the tests that Trevor suggested and continue from there.
> 
> Thanks again,
> 
> Fredrik
> 
> 23 nov 2010 kl. 15.15 skrev Andre Garzia:
> 
>> Fredrik,
>> 
>> Instead of risking problems by having concurrent queries to a single SQLite
>> database, why don't you build a middleware?
>> 
>> From your email, I understood that the problem is that you can't install a
>> server such as MySQL because the IT dept will be shouting. So why don't you
>> use LiveCode to build a little self contained server which talks to SQLite,
>> then all the clients would talk to this same server, this way, there's no
>> concurrent access since everything passes thru the server.
>> 
>> If you're on LAN then it would be überquick to get the data around and you
>> would not have to face multi user access to a single file resource (this is
>> always troublesome).
>> 
>> Andre
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list