Skip to content

Commit

Permalink
Fix bug. Date value was null when retrieved from a json expanded array.
Browse files Browse the repository at this point in the history
  modified:   storage/connect/tabjson.cpp

Assume timestamp is in milliseconds when it is a big integer
that is multiple of 1000.
  modified:   storage/connect/value.cpp
  • Loading branch information
Buggynours committed Apr 6, 2017
1 parent fcfcd99 commit 2c16792
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion storage/connect/tabjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,8 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
case TYPE_INTG:
case TYPE_BINT:
case TYPE_DBL:
vp->SetValue_pval(val->GetValue());
case TYPE_DATE:
vp->SetValue_pval(val->GetValue());
break;
case TYPE_BOOL:
if (vp->IsTypeNum())
Expand Down
6 changes: 5 additions & 1 deletion storage/connect/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,11 @@ bool DTVAL::SetValue_pval(PVAL valp, bool chktype)

ndv = ExtractDate(valp->GetCharValue(), Pdtp, DefYear, dval);
MakeDate(NULL, dval, ndv);
} else
} else if (valp->GetType() == TYPE_BIGINT &&
!(valp->GetBigintValue() % 1000)) {
// Assuming that this timestamp is in milliseconds
Tval = valp->GetBigintValue() / 1000;
} else
Tval = valp->GetIntValue();

} else
Expand Down

0 comments on commit 2c16792

Please sign in to comment.