[freetds] Config or environment setting for toggling quoted i dentifiers setting

Thompson, Bill D (London) ThompBil at exchange.uk.ml.com
Tue Jun 24 05:57:26 EDT 2003


Hi,

> I find no code to affect our default in any of our libraries (meaning, our
> ODBC default setting should be ON, but if it is, I don't know how it
> happens).  Our include/sybdb.h doesn't even mention DBQUOTEDIDENT.  

> It may be that libtds simply reflects the database's default, rather than
> forcing it one way or the other in accordance with the docs.  It would
very
> strange, though, for the same database to exhibit different defaults
> depending on the protocol version.  Is that what you're seeing?  

This is our code that produces this effect. Its in src/tds/login.c ,
function tds7_send_login()

    if (domain_login)
        option_flag2 |= 0x80;   /* enable domain login security
*/

    option_flag2 |= 0x02;       /* client is an ODBC driver
*/
    option_flag2 |= 0x01;       /* change to initial language must succeed
*/

When we log in using the TDS 7 protocol, by setting that bit in the
option_flag2, we claim to be an ODBC driver. 

If you look at SQL server books online, under "ANSI compliance options" you
will see many statements like:

"By default, ODBC and OLE DB clients issue a connection-level SET statement
setting QUOTED_IDENTIFIER to ON when connecting to SQL Server."

This little bit switch is the the mechanism by which this behaviour is
enabled. 
As far as I know, although there has been some work on the tds 7 login
packet recently, this has always been the case. 
It is probably a result of us reverse engineering the login packet from an
ODBC driver.

This bit switch could be turned off, but there may be other effects. 

Bill

> -----Original Message-----
> From:	Lowden, James K [SMTP:LowdenJK at bernstein.com]
> Sent:	23 June 2003 22:26
> To:	'FreeTDS Development Group'
> Subject:	RE: [freetds] Config or environment setting for toggling
> quoted i dentifiers setting
> 
> > From: Mark Gruetzner [mailto:mgruetzner at rw3.com]
> > Sent: June 23, 2003 4:30 PM
> > 
> > Is there a configuration option I can specify in freetds.conf or as an
> > environment variable whereby I can specify the equivalent of:
> > 
> > SET QUOTED_IDENTIFIERS OFF
> > 
> > When using tds version= 7.0 for connecting to MS SQL Server 7.0.
> 
> No, there's no such option.  But you might have found a bug.  Which
> library
> are you using?  
> 
> Microsoft's db-lib defaults to SET QUOTED_IDENTIFIER OFF; their ODBC
> defaults to ON.  tsql defaults to OFF:
> 
> 1> sp_dboption 'test',  'quoted identifier'
> 2> go
> OptionName      CurrentSetting
> quoted identifier       off
> 
> I find no code to affect our default in any of our libraries (meaning, our
> ODBC default setting should be ON, but if it is, I don't know how it
> happens).  Our include/sybdb.h doesn't even mention DBQUOTEDIDENT.  
> 
> It may be that libtds simply reflects the database's default, rather than
> forcing it one way or the other in accordance with the docs.  It would
> very
> strange, though, for the same database to exhibit different defaults
> depending on the protocol version.  Is that what you're seeing?  
> 
> But.... All "set QUOTED_IDENTIFIER OFF" would do is disallow quoted
> identifiers, such that "select * from [my table]" would be invalid.  Just
> curious, how is that better for you?  
> 
> --jkl
> 
> P. S.  Idea:  freetds.conf currently controls one default option, "text
> size".  Perhaps it should support a "setup query" instead, an arbitary
> string that would be sent for every new connection.  That way, Mark could
> have:
> 
> 	setup = "set textsize 1024 set QUOTED_IDENTIFIER OFF"
> 
> or whatever he wanted.  
> 
> 
> 
> -----------------------------------------
> The information contained in this transmission may contain privileged and
> confidential information and is intended only for the use of the person(s)
> named above. If you are not the intended recipient, or an employee or
> agent responsible for delivering this message to the intended recipient,
> any review, dissemination, distribution or duplication of this
> communication is strictly prohibited. If you are not the intended
> recipient, please contact the sender immediately by reply e-mail and
> destroy all copies of the original message. Please note that we do not
> accept account orders and/or instructions by e-mail, and therefore will
> not be responsible for carrying out such orders and/or instructions.
> 
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




More information about the FreeTDS mailing list