Skip to Content.
Sympa Menu

freetds - Re: [freetds] Query Time Out

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Query Time Out
  • Date: Tue, 8 Aug 2006 10:49:11 +0200

>
> Sorry, looks like my former post is missing:
>
>
>
> Hi,
>
> When using the ODBC driver of FreeTDS, the query will time
> out if the query was sent by a statement used before. The
> code was like:
>
> --------------------------------------------------------------
> ----------
> --------------------------------------------------------------
> ----------
> ---------------------------
>
> SQLSetStmtAttr (hstmt, SQL_ATTR_QUERY_TIMEOUT,
> (SQLPOINTER)
> 40, SQL_IS_UINTEGER);
>
> SQLPrepare(hstmt, "...");
>
> SQLExecute(hstmt);
>
> // fetch the data
>
>
>
> // Wait for 3 minutes
>
> SQLFreeStmt(hstmt, SQL_CLOSE);
>
> SQLFreeStmt(hstmt, SQL_UNBIND);
>
> SQLFreeStmt(hstmt, SQL_RESET_PARAMS);
>
> SQLCloseCursor(hstmt);
>
>
>
> SQLSetStmtAttr (hstmt, SQL_ATTR_QUERY_TIMEOUT,
> (SQLPOINTER)
> 40, SQL_IS_UINTEGER);
>
> SQLPrepare(hstmt, "...");
>
> SQLExecute(hstmt); // here I got a timeout.
>
> --------------------------------------------------------------
> ----------
> --------------------------------------------------------------
> ----------
> ---------------------------
>
>
>
> It looks to me the tds->query_start_time inside the hstmt
> was not cleaned up correctly. (Actually the value is the old time for
> the first query) This data member looks like a new one to me. (I am
> still using the a FreeTDS version from 2004 and only recently
> updated to
> the 0.64 stable)
>

Well, we do not make changes for early releases (It's very time
consuming and we have very few resources to backport anything we found)
so we'll fix 0.64. tds->query_start_time should be set when query is
sent to server to perhaps there is a problem in libTDS (the core
library)... I'll try to reproduce using your test.

>
> For now I will just create a new statement handle for each
> new query, but I would like to know whether it is a bug or just I am
> writing the wrong code.
>

It seems a bug. However is not that expensive to use new statements and
you are sure that anything allocated on the first statement is freed,
consider it as a safe workaround.

freddy77





Archive powered by MHonArc 2.6.24.

Top of Page