Commit a091314d authored by Olivier Bertrand's avatar Olivier Bertrand

Fix MDEV-12520: Decimal values can be truncated for JDBC tables

  modified:   storage/connect/jdbconn.cpp

Fix bug. Date value was null when retrieved from a json expanded array.
  modified:   storage/connect/tabjson.cpp
parent 3ac35bb0
...@@ -1235,7 +1235,8 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) ...@@ -1235,7 +1235,8 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
case 12: // VARCHAR case 12: // VARCHAR
case -1: // LONGVARCHAR case -1: // LONGVARCHAR
case 1: // CHAR case 1: // CHAR
if (jb) case 3: // DECIMAL
if (jb && ctyp != 3)
cn = (jstring)jb; cn = (jstring)jb;
else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;")) else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;"))
cn = (jstring)env->CallObjectMethod(job, chrfldid, (jint)rank, jn); cn = (jstring)env->CallObjectMethod(job, chrfldid, (jint)rank, jn);
...@@ -1261,7 +1262,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) ...@@ -1261,7 +1262,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
break; break;
case 8: // DOUBLE case 8: // DOUBLE
case 2: // NUMERIC case 2: // NUMERIC
case 3: // DECIMAL //case 3: // DECIMAL
if (!gmID(g, dblfldid, "DoubleField", "(ILjava/lang/String;)D")) if (!gmID(g, dblfldid, "DoubleField", "(ILjava/lang/String;)D"))
val->SetValue((double)env->CallDoubleMethod(job, dblfldid, rank, jn)); val->SetValue((double)env->CallDoubleMethod(job, dblfldid, rank, jn));
else else
......
...@@ -1171,6 +1171,7 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n) ...@@ -1171,6 +1171,7 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
case TYPE_INTG: case TYPE_INTG:
case TYPE_BINT: case TYPE_BINT:
case TYPE_DBL: case TYPE_DBL:
case TYPE_DATE:
vp->SetValue_pval(val->GetValue()); vp->SetValue_pval(val->GetValue());
break; break;
case TYPE_BOOL: case TYPE_BOOL:
......
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