Skip to Content.
Sympa Menu

freetds - Re: [freetds] support of SQL_ATTR_CONNECTION_DEAD

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] support of SQL_ATTR_CONNECTION_DEAD
  • Date: Sat, 26 Jan 2008 09:21:38 +0100


Il giorno ven, 25/01/2008 alle 14.26 -0600, Nick Davis ha scritto:
> Hello,
>
> I'm trying to get my code working with the FreeTDS driver (0.64) on Mac
> OS X, and notice that the attribute SQL_ATTR_CONNECTION_DEAD isn't
> supported when I call SQLGetConnectAttr; FreeTDS returns
> "HY092:[FreeTDS][SQL Server]Invalid option".
>
> SQL_ATTR_CONNECTION_DEAD is new as of ODBC 3.5, and I believe the driver
> hasn't been updated to support it. A cursory glance in odbc.c shows a
> switch/case of various connection attributes, except this one.
>
> My question is: are there any efforts underway to add ODBC 3.5 features
> to the driver, including the CONNECTION_DEAD attribute? I've checked
> the latest current release and the attribute is still missing from the
> implementation of SQLGetConnectAttr in odbc.c.
>
> Thanks,
>
> Nick

Nothing difficult to add :)

A patch like this will suite


diff -u -r1.468 odbc.c
--- src/odbc/odbc.c 14 Jan 2008 19:21:06 -0000 1.468
+++ src/odbc/odbc.c 26 Jan 2008 08:19:30 -0000
@@ -4443,6 +4450,11 @@
*((SQLUINTEGER *) Value) = dbc->attr.autocommit;
ODBC_RETURN_(dbc);
break;
+#if defined(SQL_ATTR_CONNECTION_DEAD) && defined(SQL_CD_TRUE)
+ *((SQLUINTEGER *) Value) = TDS_ISDEAD(dbc->tds_socket) ?
SQL_CD_TRUE : SQL_CD_FALSE;
+ ODBC_RETURN_(dbc);
+ break;
+#endif
case SQL_ATTR_CONNECTION_TIMEOUT:
*((SQLUINTEGER *) Value) = dbc->attr.connection_timeout;
ODBC_RETURN_(dbc);

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page