Commit 24c18ce8 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix json parser (void objects not recognized) modified: json.cpp

parent a7867410
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.07.0002 December 12, 2020"; char version[]= "Version 1.07.0002 December 18, 2020";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.07.0002 " __DATE__ " " __TIME__; char compver[]= "Version 1.07.0002 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
...@@ -1070,12 +1070,12 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp) ...@@ -1070,12 +1070,12 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
/****************************************************************************/ /****************************************************************************/
TABTYPE ha_connect::GetRealType(PTOS pos) TABTYPE ha_connect::GetRealType(PTOS pos)
{ {
TABTYPE type; TABTYPE type= TAB_UNDEF;
if (pos || (pos= GetTableOptionStruct())) { if (pos || (pos= GetTableOptionStruct())) {
type= GetTypeID(pos->type); type= GetTypeID(pos->type);
if (type == TAB_UNDEF) if (type == TAB_UNDEF && !pos->http)
type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS; type= pos->srcdef ? TAB_MYSQL : pos->tabname ? TAB_PRX : TAB_DOS;
#if defined(REST_SUPPORT) #if defined(REST_SUPPORT)
else if (pos->http) else if (pos->http)
...@@ -1083,7 +1083,8 @@ TABTYPE ha_connect::GetRealType(PTOS pos) ...@@ -1083,7 +1083,8 @@ TABTYPE ha_connect::GetRealType(PTOS pos)
case TAB_JSON: case TAB_JSON:
case TAB_XML: case TAB_XML:
case TAB_CSV: case TAB_CSV:
type = TAB_REST; case TAB_UNDEF:
type = TAB_REST;
break; break;
case TAB_REST: case TAB_REST:
type = TAB_NIY; type = TAB_NIY;
...@@ -1093,8 +1094,7 @@ TABTYPE ha_connect::GetRealType(PTOS pos) ...@@ -1093,8 +1094,7 @@ TABTYPE ha_connect::GetRealType(PTOS pos)
} // endswitch type } // endswitch type
#endif // REST_SUPPORT #endif // REST_SUPPORT
} else } // endif pos
type= TAB_UNDEF;
return type; return type;
} // end of GetRealType } // end of GetRealType
...@@ -5690,7 +5690,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5690,7 +5690,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
try { try {
// Check table type // Check table type
if (ttp == TAB_UNDEF) { if (ttp == TAB_UNDEF && !topt->http) {
topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS"; topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS";
ttp= GetTypeID(topt->type); ttp= GetTypeID(topt->type);
sprintf(g->Message, "No table_type. Was set to %s", topt->type); sprintf(g->Message, "No table_type. Was set to %s", topt->type);
...@@ -5708,7 +5708,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -5708,7 +5708,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // BSON_SUPPORT #endif // BSON_SUPPORT
case TAB_XML: case TAB_XML:
case TAB_CSV: case TAB_CSV:
ttp = TAB_REST; case TAB_UNDEF:
ttp = TAB_REST;
break; break;
default: default:
break; break;
...@@ -6131,8 +6132,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, ...@@ -6131,8 +6132,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} // endif !nblin } // endif !nblin
// Restore language type // Restore language type
if (ttp == TAB_REST) if (ttp == TAB_REST) {
ttp = GetTypeID(topt->type); ttp = GetTypeID(topt->type);
ttp = (ttp == TAB_UNDEF) ? TAB_JSON : ttp;
} // endif ttp
for (i= 0; !rc && i < qrp->Nblin; i++) { for (i= 0; !rc && i < qrp->Nblin; i++) {
typ= len= prec= dec= flg= 0; typ= len= prec= dec= flg= 0;
......
...@@ -554,7 +554,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i) ...@@ -554,7 +554,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i)
PJOB JDOC::ParseObject(PGLOBAL g, int& i) PJOB JDOC::ParseObject(PGLOBAL g, int& i)
{ {
PSZ key; PSZ key;
int level = 0; int level = -1;
PJOB jobp = new(g) JOBJECT; PJOB jobp = new(g) JOBJECT;
PJPR jpp = NULL; PJPR jpp = NULL;
...@@ -590,7 +590,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i) ...@@ -590,7 +590,7 @@ PJOB JDOC::ParseObject(PGLOBAL g, int& i)
break; break;
case '}': case '}':
if (level < 2) { if (level == 0 || level == 1) {
sprintf(g->Message, "Unexpected '}' near %.*s", ARGS); sprintf(g->Message, "Unexpected '}' near %.*s", ARGS);
throw 2; throw 2;
} // endif level } // endif level
......
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