[freetds] Query Time Out
Ou Liu
OLiu at corillian.com
Mon Aug 7 18:21:42 EDT 2006
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)
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.
More information about the FreeTDS
mailing list