Crux of the matter PostgresDAC uses PostgreSQL client library (libpq.dll) for work. In versions before 2.5.1:
First issue was the reason of incomprehensible errors at the start of applications if system can not find libpq.dll library. And that the most unpleasant many our developers faced with Access Violation errors in rtlXX.bpl packages (where XX corresponds to the IDE version). Since the library name was a constant one can't use different libraries depending on the task. And since there was no opportunity to specify exactly path from where library should be loaded there was a big chance to load wrong one. Beginning from 2.5.1 version:
In other words developer has two ways to control library loading. He may load it by explicit LoadPSQLLibrary procedure call. Or setting any of TPSQLDatabase objects Connected property to True, then LoadPSQLLibrary will be called implicitly. Let's see in example how this may be done. We're assuming that we need to load library exactly from "C:\Program Files\PostgreSQL\8.3\bin\libpq.dll". program Project1; In the second example we will use PSQL_DLL global variable and implicit library loading: program Project1; Hot switching? It would be kinda natural assumption that there is UnloadPSQLLibrary procedure. Yes, this would be the right one. Hence we may "switch" libraries on the fly. But heaven retribution will find everybody who does not disconnect every TPSQLDatabase object before hot switching: procedure HotSwitch(const ALibPath: string); Here DBList is the global variable from PSQLDbTables.pas unit. If you want to know exactly path from where library is loaded examine result of this function call S := GetModuleName(SQLLibraryHandle); |