row.push_back( "" );
} else {
SQLCHAR coldata[128*1024];
- result = SQLGetData( d_statement, i + 1, SQL_C_CHAR, (SQLPOINTER) coldata, 131702, &len );
- std::string strres = std::string(reinterpret_cast<const char*>(coldata), std::min<SQLLEN>(131701,len)); // do not use nil byte
+ result = SQLGetData( d_statement, i + 1, SQL_C_CHAR, (SQLPOINTER) coldata, sizeof(coldata), &len);
+ std::string strres = std::string(reinterpret_cast<const char*>(coldata), std::min<SQLLEN>(sizeof(coldata)-1,len)); // do not use nil byte
while(result == SQL_SUCCESS_WITH_INFO && len > 0) { // all data is consumed if len < 1
- result = SQLGetData( d_statement, i + 1, SQL_C_CHAR, (SQLPOINTER) coldata, 131702, &len );
- strres = strres + std::string(reinterpret_cast<const char*>(coldata), std::min<SQLLEN>(131701,len));
+ result = SQLGetData( d_statement, i + 1, SQL_C_CHAR, (SQLPOINTER) coldata, sizeof(coldata), &len );
+ strres = strres + std::string(reinterpret_cast<const char*>(coldata), std::min<SQLLEN>(sizeof(coldata)-1,len));
cerr<<"len="<<len<<endl;
}
// cerr<<"len="<<len<<endl;