Re: Difference between tsql and libsybdb
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 1 Oct 2012 09:44:49 +0200 Alberto Pulvirenti <[email protected]> wrote: > A useful option could be to set it as a boolean data member in the > DBLIBCONTEXT object, and add it as an option in the dbinit() function, > setting as default its current behaviour. Yes. It would also need at least one of: 1. an "emulate ODBC" property in freetds.conf 2. a way to set the compile-time default in confgure.ac and documentation. I've slowly come to understand that the easiest way to think about runtime configuration is that the library should always use environment variables, if for no other reason than that getenv(3) is easy to use. Processing freetds.conf becomes a matter of calling putenv for any variables *not* already set. I'll repeat here something I said a few years ago, for the benefit of someone who'd like to get his hands dirty. We need better session property mangement in FreeTDS. Microsoft hasn't stood still in the 20 years since it licensed SQL Server from Sybase. The gulf between a "plain old" connection and a "modern" one continues to grow, a gulf bridged by session properties. More and more desirable functionality requires one or more "ANSI" properties. A session without them is cut off from such useful features as indexed views. The fix is arcane, hard to find, and hard to understand. And unnecessary. In the ODBC driver we set the ODBC-bit in the login packet and IIRC set session properties to match what Microsoft's driver does. In db-lib, we do not set any properties because that's the way db-lib always worked, and what old db-lib applications expect. But modern db-lib applications -- those using FreeTDS's db-lib -- need a way to set the session properties at login time. One of those applications is freebcp, which currently cannot read an indexed view without some seriously clever use of the -O option. Perhaps the best outcome would be for db-lib to default to whatever settings we use in ODBC, with compile- and run-time options to revert to the current default. That would have the effect of modernizing db-lib by default while retaining backward compatibility for those who want it or need it. Toward that end I suggest someone, not me, implement a new freetds.conf setting, "ANSI defaults". If set to "yes", it would have these effects: 1. Turn on the ODBC bit in the login packet. 2. Send SET commands, upon logging in, sufficient to create and use indexed views and/or equal to those sent by the ODBC driver. The setting would affect both db-lib and ct-lib (hence implemented in libtds). Setting "ANSI defaults = no" would prevent the above-described behavior, thus reverting to current form. Regards, --jkl