Skip to Content.
Sympa Menu

freetds - RE: [freetds] proposed fix to SQLGetTypeInfo in odbc.c

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: ZIGLIO Frediano <Frediano.Ziglio AT vodafoneomnitel.it>
  • To: "'freetds AT lists.ibiblio.org'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] proposed fix to SQLGetTypeInfo in odbc.c
  • Date: Fri, 17 Jan 2003 11:03:35 +0100


> -----Original Message-----
> From: Lowden, James K [mailto:LowdenJK AT bernstein.com]
> Sent: giovedì 16 gennaio 2003 21.35
> To: 'freetds AT lists.ibiblio.org'
> Subject: RE: [freetds] proposed fix to SQLGetTypeInfo in odbc.c
>
>
> > From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafoneomnitel.it]
> > Sent: January 16, 2003 1:11 PM
> > >
> > > I found an issue in SQLGetTypeInfo (odbc.c). It is calling
> > > a stored procedure sp_datatype_info to retrieve information
> > > about supported ODBC types. Right now it calls the procedure
> > > with either zero or one argument. The second argument is
> > > not specified, and takes its default value -- ODBCVer = 2.
> > >
> > > Well ODBC Version 2 doesn't support SQL_TIMESTAMP etc. I
> > > propose a change as follows (simply adding the odbc version as "3"
> > > to the call to sp_datatype_info):
> >
> > Not acceptable. Sybase do not have ODBC version parameters...
> >
> > However this should be fixed, so another solution is to check
> > for MS (and version)...
>
> Steven,
>
> Thank you for the patch.
>
> The tds library does not determine or keep the vendor of the
> server, only
> the protocol level. Branching on TDS version is a fair
> proxy. I think it
> would be sufficient to wrap the MS-specific code in
>
> if IS_TDS7_PLUS(tds) {
> /* call with two paramters */
> } else {
> /* call with one parameter */
> }
>
> If you need this behavior with TDS 4.2, an alternative is,
> "select count(*)
> from master..syscolumns where id = object_id('sp_datatype_info')".
>
> Freddy, would those be OK?
>
> As an aside, we don't state whether our driver should be
> considered ODBC
> version 2 or 3. Either way, it's incomplete, but could
> someone tell me
> which number better describes the current status, and which
> is our goal?
>

Committed a patch.
There is a macro (TDS_IS_MSSQL) to discovery if server is mssql or not.
This stored procedure is available in both Sybase and mssql, but Sybase's
one do not have second parameter (version 11.9.2, I don't know other
versions).
To retrieve store text you can use a query like (in master database for
mssql and systemprocs or similar on Sybase)
select text from syscomments where id = (select id from sysobjects where
name = 'sp_datatype_info') order by colid

Corrent CVS version support both version 2 and 3. Recently changes make more
3 compatible, so I updated version returned to 3 (so it work with iODBC and
other programs without patching).

freddy77

=================================
"STRICTLY PERSONAL AND CONFIDENTIAL

This message may contain confidential and proprietary material for the sole
use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient please contact
the sender and delete all copies.
The contents of this message that do not relate to the official business of
our company shall be understood as neither given nor endorsed by it."

=================================




Archive powered by MHonArc 2.6.24.

Top of Page