The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
procedure TMainForm.FormShow(Sender: TObject);
var
I, J: Integer;
Drivers: IZCollection;
Protocols: TStringDynArray;
begin
ZProtocol.Clear;
Drivers := DriverManager.GetDrivers;
for I := 0 to Drivers.Count - 1 do
begin
Protocols := (Drivers.Items[I] as IZDriver).GetSupportedProtocols;
for J := 0 to High(Protocols) do begin
ZProtocol.Items.Add(Protocols[J]);
end;
end;
ZProtocol.Sorted := True;
end;
And selecting the desired protocol was the only thing which was needed to connect to the database.
ZEOS obviously selected the right library name and also the correct bitness (32/64bit).
Could someone give me a hint how (and where in ZEOS) that is done or at least tell me how to get the standard name of a library determined by the selected protocol (under different operating systems).
ZEOS should at least tell me the library names by protocol.
each driver has a list of library names which Zeos tries to load on request. These libraries are listed in the plain driver part of the driver. Taking MySQL as an example:
In ZPlainMySqlDriver.pas there is the following part:
I think it's great that ZEOS has such sophisticated functions to guess "missing" inputs.
However, I would like to know where and how to place the access libraries under Windows so that they are easily found by zeos.
It would also be nice to be able to determine which library is currently being used to see if the correct one is in use. Of course this would be more a function for an administrator or the programmer to see if everything is running correctly.
CharlyTango wrote: ↑02.01.2023, 10:43
However, I would like to know where and how to place the access libraries under Windows so that they are easily found by zeos.
There is no general rule for this. For most databases I suggest to place the libraries alongside the application and use the TZConnection property LibraryLocation. This will keep zeos from guessing and make it try one library only. Usually I distribute the client libraries along with my programs and have a subfolder for them. Something like:
procedure TMyDatamodule.OnCreate(Sender: TObject);
begin
// some initialization code before these lines
ZeosConnection.LibraryLocation := ExtractFilePath(ParamStr(0)) + 'firebird-3.0\fbclient.dll';
// more code here
end;
Another idea is to load a library location from an ini file or from the registry.
CharlyTango wrote: ↑02.01.2023, 10:43
It would also be nice to be able to determine which library is currently being used to see if the correct one is in use.
If you go the above way, you know which library is in use because if you provide a library to use, Zeos will not try to load other libraries.
CharlyTango wrote: ↑02.01.2023, 10:43It would also be nice to be able to determine which library is currently being used to see if the correct one is in use.
It's actually possible, I even posted it on this forum a while ago. Can not find it atm, so here you go:
If Assigned(ZConnection1.DbcConnection) And
Assigned(ZConnection1.DbcConnection.GetIZPlainDriver) And
Assigned(ZConnection1.DbcConnection.GetIZPlainDriver.GetInstance.Loader) Then
WriteLn(GetModuleName(ZConnection1.DbcConnection.GetIZPlainDriver.GetInstance.Loader.Handle));
function TZAbstractConnection.GetLibraryInUse: String;
begin
Result := '';
if Active and
Assigned(DbcConnection) And
Assigned(DbcConnection.GetIZPlainDriver) And
Assigned(DbcConnection.GetIZPlainDriver.GetInstance.Loader) and
(DbcConnection.GetIZPlainDriver.GetInstance.Loader.Handle <> 0)
then
Result := GetModuleName(ZConnection1.DbcConnection.GetIZPlainDriver.GetInstance.Loader.Handle);
end;
MJFShark wrote: ↑05.01.2023, 04:44But maybe that's not needed.
Afaik it's unnecessary, as GetInstance returns a new instance. As long as there's a plain driver, you'll always get an instance.
I did not check the code right now, though so I might be wrong.
If anyone is about to add this please make sure that it will continue to work if we finally get rid of Zeos's notorious driver library caching :)
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47