Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQLGetTypeInfo() fails when it is called for the second time

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: marko68 GMX <marko68 AT gmx.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQLGetTypeInfo() fails when it is called for the second time
  • Date: Wed, 8 Oct 2008 16:00:16 -0700

JKL> marko68 GMX wrote:
>>
>> find_an_appropriate_data_type(...)
>> {
>> SQLBindCol(hToStmt, 1, SQL_C_CHAR, szTypeName ...);
>> SQLBindCol(hToStmt, 3, SQL_C_LONG, &cbMaxPrec,...);
>> ...
>> SQLGetTypeInfo(hstmt, fSqlType) (where fSqlType is 5 (small integer))
>> SQLFetch(hstmt);
>> ...
>> SQLFreeStmt(hstmt, SQL_CLOSE);
>>
>> if !(does_the_found_MS_SQL_data_type_suit_us)
>> try another one;
>> }
>> The main idea behind this cycle is an attempt to figure out the right
>> correspondence between available (supported by the application) data
>> types and the ones supported by MS SQL. The first call of the
>> function returns the requested type info, but the second call
>> fails: SQLGetTypeInfo returns -1. The call of SQLGetDiagRec
>> returns the following error:
>>
>> 08S01 - [FreeTDS][SQL Server]Communication link failure

JKL> Please post a TDSDUMP log of the session. Perhaps that will shed some
JKL> light.

The log file is attached (43Kb). And although I have found the
workaroud (every time when I sequentially call the function
find_an_appropriate_data_type() I allocate new handle) I would be
interested to know your opinion on what happens in this case.

--
Thanks,
Marko

Attachment: freetds.log
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page