fix limit bug in excel truncation.

This commit is contained in:
Matt Wells
2014-04-11 11:51:12 -07:00
parent b4e7a0df71
commit d5e939c44f
2 changed files with 30 additions and 2 deletions

@ -5537,7 +5537,21 @@ bool Msg40::printJsonItemInCSV ( State0 *st , long ix ) {
// print the value
sb->pushChar('\"');
sb->csvEncode ( ji->getValue() , ji->getValueLen() );
// get the json item to print out
long vlen = ji->getValueLen();
// truncate
char *truncStr = NULL;
if ( vlen > 32000 ) {
vlen = 32000;
truncStr = " ... value truncated because "
"Excel can not handle it. Download the "
"JSON to get untruncated data.";
}
// print it out
sb->csvEncode ( ji->getValue() , vlen );
// print truncate msg?
if ( truncStr ) sb->safeStrcpy ( truncStr );
// end the CSV
sb->pushChar('\"');
}

@ -5612,7 +5612,21 @@ bool printJsonItemInCSV ( char *json , SafeBuf *sb , State0 *st ) {
// print the value
sb->pushChar('\"');
sb->csvEncode ( ji->getValue() , ji->getValueLen() );
// get the json item to print out
long vlen = ji->getValueLen();
// truncate
char *truncStr = NULL;
if ( vlen > 32000 ) {
vlen = 32000;
truncStr = " ... value truncated because "
"Excel can not handle it. Download the "
"JSON to get untruncated data.";
}
// print it out
sb->csvEncode ( ji->getValue() , vlen );
// print truncate msg?
if ( truncStr ) sb->safeStrcpy ( truncStr );
// end the CSV
sb->pushChar('\"');
}