going multi-user

Just starting out? Need help? Post your questions and find answers here.
gabriel
Enthusiast
Enthusiast
Posts: 137
Joined: Sat Aug 01, 2009 4:49 pm
Location: Beirut, Lebanon

going multi-user

Post 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
Nituvious
Addict
Addict
Posts: 1027
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: going multi-user

Post 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.
▓▓▓▓▓▒▒▒▒▒░░░░░
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Re: going multi-user

Post 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.. :mrgreen:
gabriel
Enthusiast
Enthusiast
Posts: 137
Joined: Sat Aug 01, 2009 4:49 pm
Location: Beirut, Lebanon

Re: going multi-user

Post 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
);
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: going multi-user

Post 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
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply