summaryrefslogtreecommitdiff
path: root/storage/connect/json.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect/json.cpp')
-rw-r--r--storage/connect/json.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index bd9c4fac7a1..e9925ee959a 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -54,15 +54,24 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e);
#endif // SE_CATCH
char *GetJsonNull(void);
+int GetDefaultPrec(void);
/***********************************************************************/
/* IsNum: check whether this string is all digits. */
/***********************************************************************/
-bool IsNum(PSZ s) {
- for (char* p = s; *p; p++)
+bool IsNum(PSZ s)
+{
+ char* p = s;
+
+ if (*p == '-')
+ p++;
+
+ if (*p == ']')
+ return false;
+ else for (; *p; p++)
if (*p == ']')
break;
- else if (!isdigit(*p) || *p == '-')
+ else if (!isdigit(*p))
return false;
return true;
@@ -1257,6 +1266,8 @@ PJVAL JARRAY::GetArrayValue(int i)
{
if (Mvals && i >= 0 && i < Size)
return Mvals[i];
+ else if (Mvals && i < 0 && i >= -Size)
+ return Mvals[Size + i];
else
return NULL;
} // end of GetValue
@@ -1752,7 +1763,7 @@ void JVALUE::SetBigint(PGLOBAL g, long long ll)
void JVALUE::SetFloat(PGLOBAL g, double f)
{
F = f;
- Nd = 6;
+ Nd = GetDefaultPrec();
DataType = TYPE_DBL;
} // end of SetFloat