Closed gkarthiks closed 3 years ago
Why rodhoward skips null values at all ?
BTW my forked version provides a columns parameter in the callback function. Also I've added a query2Csv() function => sybase-plus
So yep I'm not bothering to put null values into the row object. I think this fine though it doesn't lose you any information and this way you don't need to deal with "null" in javascript just undefined. which is nice..
for (int c = 1; c< colCount+1; c++)
{
Object val = rs.getObject(c);
if (val == null) continue;
int dataType = meta.getColumnType(c);
switch (dataType)
{
case SybaseDB.TYPE_TIME_STAMP:
case SybaseDB.TYPE_DATE:
String my8601formattedDate = df.format(new Date(rs.getTimestamp(c).getTime()));
row.put(columns[c], my8601formattedDate);
break;
default:
row.put(columns[c], rs.getObject(c));
}
}
}
The
column:value
pair is ignored in the resultingJSON
when any column of any row isnull
.This makes inconsistency in the resulting JSON data. I would expect to return back
null
orempty
value with the key as correspondingcolumn_name
.