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

marko68 GMX marko68 at gmx.net
Wed Oct 8 19:00:16 EDT 2008


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds.log
Type: application/octet-stream
Size: 43293 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20081008/8cd359e3/attachment-0001.obj 


More information about the FreeTDS mailing list