On Wed, 15 Aug 2012, Ludo Brands wrote:
No, this would suggest that you can set a different value for
each instance.
I don't see what is wrong with that. You get a nice exception when you try
to load a different library than the one that is alread loaded. But if I
want to make an app that works with embedded firebird or firebird client
(user selectable at any time) that have completely different settings (user,
password, database, etc), what is I wrong with creating 2 instances in the
OI and connect only one at the time?
IMHO that would be a total waste:
Since you'll have to store username/password/db file anyway in some
form of user settings, you might as well store the library name as well.
It so happens that I have an application in production that does
all this.
It only requires a restart in case you choose another library.
You can't be connected the 2 at the
same time but that is a run-time issue, not design time.
Because only 1 library can be loaded for each type of connection:
the entry points are global.
What you suggest implicates keeping a reference count, unloading,
and then reloading.
Ivo Steinmann tried implementing that once, and all his efforts
were undone because it gave too much problems (specially the
unloading if I recall correctly).
I think a settings dialog in the component editor (from the
form designer) would be better. Or a settings dialog under 'Tools'.
Where would you store the value(s) then so that
1) it can be streamed
It does not need to be streamed, I imagined an IDE setting only.
You pointed out that one cannot set the library for the IDE;
I merely point out a solution for that.
The library name to use - per type of connection - can be stored in the IDE
settings.
2) the instances can pick up the value (instances decide whether connection
is active or not. Current implementation will load library when the first
connection becomes active)
But does not unload correctly.
3) when using multiple db backends (FB + postgres for example) the instances
pick up the correct library
The setting is for the IDE only: One setting per type of backend.
I do not think a solution is required for the components.
Yes, you cannot set the location in the OI, but I do not think
this is needed in the first place, see the use case at the beginning.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal