print numbers as strings when printing the csv

This commit is contained in:
Matt Wells
2015-04-24 10:26:53 -06:00
parent 0a48930ba3
commit e254118b5f

@ -8371,6 +8371,7 @@ bool printJsonItemInCSV ( char *json , SafeBuf *sb , State0 *st ) {
//
// get value and print otherwise
//
/*
if ( ji->m_type == JT_NUMBER ) {
// print numbers without double quotes
if ( ji->m_valueDouble *10000000.0 ==
@ -8380,11 +8381,15 @@ bool printJsonItemInCSV ( char *json , SafeBuf *sb , State0 *st ) {
sb->safePrintf("%f",ji->m_valueDouble);
continue;
}
*/
int32_t vlen;
char *str = ji->getValueAsString ( &vlen );
// print the value
sb->pushChar('\"');
// get the json item to print out
int32_t vlen = ji->getValueLen();
//int32_t vlen = ji->getValueLen();
// truncate
char *truncStr = NULL;
if ( vlen > 32000 ) {
@ -8394,7 +8399,7 @@ bool printJsonItemInCSV ( char *json , SafeBuf *sb , State0 *st ) {
"JSON to get untruncated data.";
}
// print it out
sb->csvEncode ( ji->getValue() , vlen );
sb->csvEncode ( str , vlen ); // ji->getValue() , vlen );
// print truncate msg?
if ( truncStr ) sb->safeStrcpy ( truncStr );
// end the CSV