[freetds] MSSQL TEXTSIZE for large text files is not returning anyvalues

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Dec 28 11:33:13 EST 2005


> 
> Hello,
> 
> I'm connecting to a MSSQL database which has a table with 2 
> text columns.
> 
> When connecting to the table, I'm unable to display those 2 
> columns. I tried
> to convert to a varchar... but 8000 bytes is not long enough 
> for the data I
> tried to access.
> 
> I changed the TEXTSIZE to a bigger value, but when I go over 
> 300, nothing is
> ouputted. I checked in the logs, and everything is received 
> correctly...
> here it is, if you can help me, I would really appreciate.
> 

...
> 
> RESULTS is :
> [root at localhost examples]# isql -cbdv -x0x09 879_2005 AWFM ********
> +----------------------------- ----------+
> | Connected!                             |
> |                                       |
> | sql-statement                         |
> | help [tablename]                      |
> | quit                                  |
> |                                       |
> +---------------------------------------+
> SQL> SELECT BODY FROM CombinedBody WHERE CKT LIKE 'LCLXXU099969%'
> BODY
> 
> SQL>
> 
> 
> My freetds.conf file look like this :
> 
> [global]
>         # TDS protocol version
>         tds version = 4.2
> 
>         # Whether to write a TDSDUMP file for diagnostic purposes
>         # (setting this to /tmp is insecure on a multi-user system)
>         dump file = /tmp/freetds.log
>         debug level = 10
> 
> 
>         text size = 100000
> 
> #Database with all the 879 information being sent from MCCDS 
> to NSC_HUB to
> FWFM (SB)
> [Search879]
>         host = AL2CAD.XX.XXXX.XX <http://al2cad.on.bell.ca/>
>         port = 1433
>         tds version = 8.0
> #       client charset = UTF-8
> 
> #########
> Any ideas why the logs show that it receive the information 
> correctly, but
> it is not returned by isql? Freetds bug?
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> 

>From unixODBC

    nReturn = SQLFetch( hStmt );
    while ( nReturn == SQL_SUCCESS || nReturn == SQL_SUCCESS_WITH_INFO )
    {
                /* COLS */
        for( nCol = 1; nCol <= nColumns; nCol++ )
        {
            nOptimalDisplayWidth = OptimalDisplayWidth( hStmt, nCol,
nUserWidth );
            nReturn = SQLGetData( hStmt, nCol, SQL_C_CHAR,
(SQLPOINTER)szColumnValue, sizeof(szColumnValue), &nIndicator );
            szColumnValue[MAX_DATA_WIDTH] = '\0';

            if ( nReturn == SQL_SUCCESS && nIndicator != SQL_NULL_DATA )
            {
                sprintf( (char*)szColumn, "| %-*.*s",
nOptimalDisplayWidth, nOptimalDisplayWidth, szColumnValue );
            }
                else if ( nReturn == SQL_ERROR )
            {
                        break;
                }
            else
            {
                sprintf( (char*)szColumn, "| %-*s",
nOptimalDisplayWidth, "" );
            }
                        fputs( (char*)szColumn, stdout );
        } /* for columns */

        nRows++;
        printf( "|\n" );
        nReturn = SQLFetch( hStmt );
    } /* while rows */


in isql.h

#define MAX_DATA_WIDTH 300

SQLGetData returns SQL_SUCCESS_WITH_INFO if data are truncated (which is
the case in this situation) so isql print just spaces. I don't think
isql is written to manage so large data.

freddy77



More information about the FreeTDS mailing list