[freetds] SQLGetTypeInfo() fails when it is called for the second time (10/08/2008 Dmitry Basko)

James K. Lowden jklowden at freetds.org
Wed Oct 8 18:16:42 EDT 2008


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

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

--jkl


More information about the FreeTDS mailing list