Re: Cannot Use DBVERSION_72 With DBLIB In 0.91 Release

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Sun, 4 Sep 2011 10:21:57 -0400
Ken Collins <[email protected]> wrote:

> >> 2) I found out that dbsetversion is basically a no-op that sets a
> >> global. 
> > 
> > Sorry?  A "no-op that sets a global" is a contradiction. 
> 
> Maybe a bad term on my part, the code comment said it has "No effect
> on behavior". It does set the global and that global is not used
> anywhere from my code search too.

Confirmed, Ken.  dbsetversion() should call tds_set_version().   The
code you found was probably a placeholder once upon a time that never
got finished.  Most people don't care, you see, because freetds.conf
and TDSVER cover the same territory.  (I wonder how many db-lib
programs ever called dbsetversion() or dbsetlversion().  I used
Microsoft's db-lib for over 10 years without setting the version.)

> If anyone has advice on why dbsetlversion() is not doing what I
> expect, I'd love to hear it. I was thinking it would set the version
> in the login structure and work exactly like setting the TDSVER
> environment variable or "tds version" in a external conf file.

It should work that way, but it looks like it doesn't.  dbsetlversion()
correctly calls tds_set_version(), which is used by ct-lib and db-lib.
Likely as not the tds_version of the login record is overwritten by
tds_config_verstr() when the connection is made.  That whole process
has always been more complicated than it needs to be, attracting
gnats.  

Maybe it should call putenv(3) instead....

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.