[Gambas-user] how to avoid second instance in hole project
taboege at gmail.com
Tue Nov 28 22:33:36 CET 2017
On Tue, 28 Nov 2017, PICCORO McKAY Lenz wrote:
> hi tobias, its safe to use module in loading of config files?
> i mean, i not have the practice or skills but i propose made a mini
> framework to speed up the developming in my job..
> we need a common and consistent code and i try to made a common lib/module
> that init the db using config file detected
> this logic must be same/work for both web/xcgi or desktop gambas
> it's there safe to use module in this case? as i ask, was thinking on
> detect instanciation of!
No idea. I would say it depends on how you do it. Generally using modules
is safe. Your web server will probably spawn a new Gambas process for every
access to your CGI script. There may me many instances of your module
running on the server at some point in time, but they are all isolated in
separate processes. Of course you have to be careful when you write to
files in this environment, but reading configuration files and connecting
to databases should be safe.
I have a custom CMS, implemented as a single CGI script, which reads
database connection information from a Settings file. It works and I don't
see why it wouldn't work if you exchange gb.web and the surroundings for
gb.qt4. If you plan on using gb.web.form, the situation *could* be
different. I can't remember anymore how exactly this component maintains
its state across AJAX calls. You have to test that yourself.
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User