Commit 6a94ad98 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix crash on Json date columns

parent 49428c8f
...@@ -1587,7 +1587,17 @@ void JVALUE::SetValue(PGLOBAL g, PVAL valp) ...@@ -1587,7 +1587,17 @@ void JVALUE::SetValue(PGLOBAL g, PVAL valp)
Val->Type = TYPE_NULL; Val->Type = TYPE_NULL;
} else switch (valp->GetType()) { } else switch (valp->GetType()) {
case TYPE_STRING: case TYPE_STRING:
case TYPE_DATE: if (((DTVAL*)valp)->IsFormatted())
Val->Strp = valp->GetCharValue();
else {
char buf[32];
Val->Strp = PlugDup(g, valp->GetCharString(buf));
} // endif Formatted
Val->Type = TYPE_DTM;
break;
case TYPE_DATE:
Val->Strp = valp->GetCharValue(); Val->Strp = valp->GetCharValue();
Val->Type = TYPE_STRG; Val->Type = TYPE_STRG;
break; break;
......
...@@ -160,7 +160,7 @@ enum RECFM {RECFM_DFLT = 0, /* Default table type */ ...@@ -160,7 +160,7 @@ enum RECFM {RECFM_DFLT = 0, /* Default table type */
RECFM_FMT = 8, /* FMT formatted file */ RECFM_FMT = 8, /* FMT formatted file */
RECFM_VCT = 9, /* VCT formatted files */ RECFM_VCT = 9, /* VCT formatted files */
RECFM_XML = 10, /* XML formatted files */ RECFM_XML = 10, /* XML formatted files */
RECFM_JASON = 11, /* JASON formatted files */ RECFM_JSON = 11, /* JSON formatted files */
RECFM_DIR = 12, /* DIR table */ RECFM_DIR = 12, /* DIR table */
RECFM_ODBC = 13, /* Table accessed via ODBC */ RECFM_ODBC = 13, /* Table accessed via ODBC */
RECFM_JDBC = 14, /* Table accessed via JDBC */ RECFM_JDBC = 14, /* Table accessed via JDBC */
......
...@@ -418,7 +418,8 @@ class DllExport DTVAL : public TYPVAL<int> { ...@@ -418,7 +418,8 @@ class DllExport DTVAL : public TYPVAL<int> {
virtual bool SetValue_char(const char *p, int n); virtual bool SetValue_char(const char *p, int n);
virtual void SetValue_psz(PCSZ s); virtual void SetValue_psz(PCSZ s);
virtual void SetValue_pvblk(PVBLK blk, int n); virtual void SetValue_pvblk(PVBLK blk, int n);
virtual char *GetCharString(char *p); virtual PSZ GetCharValue(void) { return Sdate; }
virtual char *GetCharString(char *p);
virtual int ShowValue(char *buf, int len); virtual int ShowValue(char *buf, int len);
virtual bool FormatValue(PVAL vp, PCSZ fmt); virtual bool FormatValue(PVAL vp, PCSZ fmt);
bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0); bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment