Page 1 of 1

DBLib .ClientVersion

Posted: 14.12.2021, 15:51
by aehimself
Hello,

As it turns out, dblib exports a function called "dbversion" which returns the client engine version in use as a string. I managed to implement it to Zeos, so now for example "freetds v1.4.dev.20211204" properly returns "1.4" if we call ZConnection.ClientVersionStr.
As FreeTDS is being used for other than MSSQL I'm a bit hesitant to send it as a patch, plus I have no idea if all FreeTDS editions will actually return their version in this format...?

In theory I safeguarded it with a string start check, otherwise I simply return 0 so it should be fine, but...

I'm also sure that performance wise my implementation is suboptimal - PAnsiChars can be accessed with pointer magic which I'm not experienced with.

What do you guys think? Just send it and we'll adjust based on the long run?

Re: DBLib .ClientVersion

Posted: 14.12.2021, 15:54
by marsupilami
aehimself wrote: 14.12.2021, 15:51 What do you guys think? Just send it and we'll adjust based on the long run?
Yes - exactly this :) Make it work first - make it work fast afterwards. Also I doubt that the decoding of a client library version is performance critical ;)

Best regards,

Jan

Re: DBLib .ClientVersion

Posted: 14.12.2021, 15:59
by aehimself
Done, pull request is created on GitHub.
I copied the loading implementation of an other function but DBLib seems to be a mess from this perspective (what is the purpose of the _stdcall functions if we never assign them...?!) so I only can hope I did it right.

Just review before applying it, please :)

Re: DBLib .ClientVersion

Posted: 15.12.2021, 11:25
by marsupilami
I applied the patch - without a review. Let's see what happens. I will have a look at the stdcall thing.