Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Steven Reynolds" <sreynolds AT bradmark.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] proposed fix to SQLGetTypeInfo in odbc.c
  • Date: Thu, 16 Jan 2003 12:07:31 -0600

Kind list readers

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):

local> diff odbc.c odbc.c.patch
2264c2264
< static const char *sql = "EXEC sp_datatype_info";
---
> static const char *sql = "EXEC sp_datatype_info 0 , 3";
2269c2269
< static const char sql_templ[] = "EXEC sp_datatype_info %d";
---
> static const char sql_templ[] = "EXEC sp_datatype_info %d ,
3";


Is this agreeable? If so, could someone update the cvs source for me?
I really want to be able to use SQL_TIMESTAMP's.

Thanks!

A diff with context of the same change follows:

local> diff -c odbc.c odbc.c.patch
*** odbc.c Sat Jan 11 12:13:49 2003
--- odbc.c.patch Thu Jan 16 11:52:01 2003
***************
*** 2261,2272 ****
/* For MSSQL6.5 and Sybase 11.9 sp_datatype_info work */
/* FIXME what about early Sybase products ? */
if (!fSqlType) {
! static const char *sql = "EXEC sp_datatype_info";

if (SQL_SUCCESS != odbc_set_stmt_query(stmt, sql,
strlen(sql)))
return SQL_ERROR;
} else {
! static const char sql_templ[] = "EXEC sp_datatype_info %d";
char sql[sizeof(sql_templ) + 20];

/* TODO ODBC3 convert type to ODBC version 2 (date) */
--- 2261,2272 ----
/* For MSSQL6.5 and Sybase 11.9 sp_datatype_info work */
/* FIXME what about early Sybase products ? */
if (!fSqlType) {
! static const char *sql = "EXEC sp_datatype_info 0 , 3";

if (SQL_SUCCESS != odbc_set_stmt_query(stmt, sql,
strlen(sql)))
return SQL_ERROR;
} else {
! static const char sql_templ[] = "EXEC sp_datatype_info %d ,
3";
char sql[sizeof(sql_templ) + 20];

/* TODO ODBC3 convert type to ODBC version 2 (date) */





Archive powered by MHonArc 2.6.24.

Top of Page