Page 1 of 1
going multi-user
Posted: Sat Dec 05, 2009 9:14 pm
by gabriel
Hello:
I've made a small accountancy program, I'm asked if it can be made multi-user. So how can a file be accessible by two applications in the same time?
thanks
Re: going multi-user
Posted: Sun Dec 06, 2009 4:22 am
by Nituvious
I think in Windows you can read the same file by multiple programs.
If you're not writing to the file you shouldn't have a problem.
I am a newbie at PureBasic, so I probably do not understand your question fully.
Re: going multi-user
Posted: Sun Dec 06, 2009 1:15 pm
by Baldrick
By small accountancy program I would assume you are have written some kind of Database application?
This being the case, what database format would you have used to start with?? as this will make a whole bunch of difference between single & multiuser applications of this nature...
More information on just what you have done is really required to answer your questions i think gabriel.
fwiw gabriel, I started to voluntarily write what I think may be a similar application for a firm I am working for which I had running very smoothly using SQLite3. Then all of a sudden I was being asked ( sorry, TOLD) about it being accessed online by all different people working for this firm simultaneously just like all these 'wannabe' online business control systems that never work properly, so I dropped the whole thing with the opinion "If you want something like that, then you are gonna have to pay me at full developer rates!!!!" Needless to say, I never did finish that program..

Re: going multi-user
Posted: Sun Dec 06, 2009 9:24 pm
by gabriel
Thanks for reply!
In fact, I developped myself a personnal database system, it's simple ascii text file, with functions like addrecord(), modifyrecord(), deleterecord(), etc......
It's simple and works very good (I don't know any database system).
Essentially, I use FileSeek, WriteString, ReadString to access and modify files.
Now the question is how to access the same file by two differents applications? is simultaneous read and write possible?
I had a look at winapi function CreateFile, I noticed the "dwShareMode" parameter, can this be the solution??
I'll do some tests in the coming days. Meanwhile any help is welcomed!
HANDLE CreateFile(
LPCTSTR lpFileName, // pointer to name of the file
DWORD dwDesiredAccess, // access (read-write) mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // pointer to security attributes
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle to file with attributes to copy
);
Re: going multi-user
Posted: Mon Dec 07, 2009 4:35 pm
by blueznl
Seeing how easy it is to run a real SQL database, I suggest to go that way.
A little basic info that I've compiled you can find here (you might already have looked at it, dunno

)
http://www.xs4all.nl/~bluez/purebasic/p ... 13.htm#top