Zeos get some Info

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
Post Reply
CharlyTango
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 20.10.2017, 14:41

Zeos get some Info

Post by CharlyTango »

Hi,

after some research i found the possibility in one of the zeos examples to ask ZEOS which protocols are supported.

Code: Select all

Drivers := DriverManager.GetDrivers;
    for I := 0 to Drivers.Count - 1 do
  begin
    Protocols := (Drivers.Items[I] as IZDriver).GetSupportedProtocols;
    IZDriver.
    for J := 0 to High(Protocols) do
      ZProtocol.Items.Add(Protocols[J]);
  end; 
But i had not found any possibility to ask ZEOS for standard names of the supported connection libraries and standard ports.

The SQLDB Package of Lazarus provides these possibilities and ai cannot imagine that ZEOS lacks such a possibility.
This package also provides some kind of proxy component that manages the connectors by chosen protocol. Does a similar structure exists in ZEOS?

Please guide me to the right track.

THX
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1962
Joined: 17.01.2011, 14:17

Re: Zeos get some Info

Post by marsupilami »

Hello CharlyTango,
CharlyTango wrote: 28.12.2022, 17:44 Hi,

after some research i found the possibility in one of the zeos examples to ask ZEOS which protocols are supported.

Code: Select all

Drivers := DriverManager.GetDrivers;
    for I := 0 to Drivers.Count - 1 do
  begin
    Protocols := (Drivers.Items[I] as IZDriver).GetSupportedProtocols;
    IZDriver.
    for J := 0 to High(Protocols) do
      ZProtocol.Items.Add(Protocols[J]);
  end; 
There is a more simple way. This is what I do:

Code: Select all

  ZConnection.GetProtocolNames(ProtocolsCB.Items);
This will ask the TZConnection object ZConnection to put all supported protocols in the TSTrings property Items of the ProtocolsCB combo box. But you can fill any TStrings descandant.
CharlyTango wrote: 28.12.2022, 17:44 But i had not found any possibility to ask ZEOS for standard names of the supported connection libraries and standard ports.
There really isn't a way to ask that to the driver.

Short answer:
What would you do with that information? Setting the port number to 0 will tell Zeos to use the default port. And keeping the library name empty will tell Zeos to just try the default library names.

Long answer:
Port numbers: Providing this kind of information may lead to wrong assumptions on the users side. Assume the following: In most cases Firebird uses Port 3050. But there also is the possibility to change that in the configuration files. So maybe an admin has good reason to set the default port to 3501 on some machine.
Now assume that Zeos provides information about the default port number (3050) and a user thinks "Oh fine, let's just always put that into the port property of my TZConnection object." And now we start overriding port number set by the admin (3051) with the default port number pulled from some Zeos interface (3050). And the user will have a hard time in finding the error.
Things can get more compilcated: MS SQL Server has a way to run several instances on one computer and they are not distinguished by port numbers but by names in the first place. There it is the task of the client library to find out the correct port number.
And as far as I can tell, the oracle driver doesn't even use the port number at all.

connection libraries: When it comes to libraries there is even more to think about: What help is getting the library names to you? Each driver has a built in list of library names. But that doesn't mean that libraries which are not on that list are not supported. It just means that nobody added them. Zeos will try each of these libraries in turn if you don't provide a library name.

With best regards,

Jan
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: Zeos get some Info

Post by Fr0sT »

More to say, Zeos uses no default ports at all (except for MySQL - and I think it should be removed - https://dev.mysql.com/doc/c-api/8.0/en/ ... nnect.html) leaving this option to user or driver internals (config/default). And I think it's right. Transport level should be left to the driver, Zeos shouldn't bother about such details
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1962
Joined: 17.01.2011, 14:17

Re: Zeos get some Info

Post by marsupilami »

Fr0sT wrote: 09.01.2023, 09:20 More to say, Zeos uses no default ports at all (except for MySQL - and I think it should be removed - https://dev.mysql.com/doc/c-api/8.0/en/ ... nnect.html)
We have a hard coded default port for MySQL? I agree it should be removed but I currently cannto spare the time to do that. Couls you maybe prepare a patch?

Best regards,

Jan
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: Zeos get some Info

Post by Fr0sT »

marsupilami wrote: 12.01.2023, 09:40 We have a hard coded default port for MySQL? I agree it should be removed but I currently cannto spare the time to do that. Couls you maybe prepare a patch?
Turns out we do :)
Sure, this is really tiny patch but want to ensure it builds so I'll do it on Monday
Post Reply