Skip to Content.
Sympa Menu

freetds - Re: [freetds] Difference between tsql and libsybdb

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: freetds AT lists.ibiblio.org
  • Subject: Re: [freetds] Difference between tsql and libsybdb
  • Date: Tue, 2 Oct 2012 12:34:45 -0400

On Mon, 1 Oct 2012 09:44:49 +0200
Alberto Pulvirenti <alberto.pulvirenti AT crowdengineering.com> 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




Archive powered by MHonArc 2.6.24.

Top of Page