Skip to Content.
Sympa Menu

freetds - [freetds] iconv problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] iconv problem
  • Date: Wed, 23 Jul 2003 15:32:45 +0200

Testing odbc

$ ./t0001
odbctest
--------

connection parameters:
server: 'OPDN014'
user: 'sa'
password: '????'
database: 'tempdb'
use tempdb
drop table #odbctestdata
Unable to execute statement
create table #odbctestdata (col1 varchar(30) not null,col2 int not
null,col3 float not null,col4 numeric(18,6) not null,col5 datetime not
null,col6 text not null)
Unable to execute statement
SQL error S1000 -- [unixODBC]iconv E2BIG: Error converting between
character sets. Output buffer exhausted.

Calling tds_put_string with TDS7 and a query longer than 128 characters
produce this problem

>From write.c

if (IS_TDS7_PLUS(tds)) {
while (len > 0) {
tdsdump_log(TDS_DBG_NETWORK, "%L tds_put_string
converting %d bytes of \"%s\"\n", len, s);
outbytesleft = sizeof(outbuf);
poutbuf = outbuf;
if (-1 == tds_iconv(tds, tds->iconv_info,
to_server, &s, &len, &poutbuf, &outbytesleft))
break;
bytes_out = poutbuf - outbuf;
tds_put_n(tds, outbuf, bytes_out);
}
tdsdump_log(TDS_DBG_NETWORK, "%L tds_put_string wrote %d
bytes\n", bytes_out);
return bytes_out;
}

tds_put_string should manage string in chunk but it return after first
tds_iconv (cause it return -1) and return 0 as bytes_out... On E2BIG
error tds_iconv add a message to client but doing chunk conversion this
is not the right behavior... Also in tds_put_string poutput buffer
should be initialized for every loop (the code above is already patched,
see line before tds_iconv call) and bytes_out should contain all bytes
written, not only last write count.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page