MCPcopy Create free account
hub / github.com/MariaDB/server / CheckPath

Method CheckPath

storage/connect/jsonudf.cpp:693–728  ·  view source on GitHub ↗

/ CheckPath: Checks whether the path exists in the document. */ /

Source from the content-addressed store, hash-verified

691/* CheckPath: Checks whether the path exists in the document. */
692/*********************************************************************************/
693my_bool JSNX::CheckPath(PGLOBAL g)
694{
695 PJVAL val= NULL;
696 PJSON row = Row;
697
698 for (int i = 0; i < Nod && row; i++) {
699 val = NULL;
700
701 if (Nodes[i].Op == OP_NUM || Nodes[i].Op == OP_XX) {
702 } else switch (row->GetType()) {
703 case TYPE_JOB:
704 if (Nodes[i].Key)
705 val = ((PJOB)row)->GetKeyValue(Nodes[i].Key);
706
707 break;
708 case TYPE_JAR:
709 if (!Nodes[i].Key)
710 if (Nodes[i].Op == OP_EQ || Nodes[i].Op == OP_LE)
711 val = ((PJAR)row)->GetArrayValue(Nodes[i].Rank);
712
713 break;
714 case TYPE_JVAL:
715 val = (PJVAL)row;
716 break;
717 default:
718 snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->GetType());
719 } // endswitch Type
720
721 if (i < Nod-1)
722 if (!(row = (val) ? val->GetJsp() : NULL))
723 val = NULL;
724
725 } // endfor i
726
727 return (val != NULL);
728} // end of CheckPath
729
730/***********************************************************************/
731/* GetRow: Set the complete path of the object to be set. */

Callers 1

jsoncontains_pathFunction · 0.45

Calls 4

GetTypeMethod · 0.45
GetKeyValueMethod · 0.45
GetArrayValueMethod · 0.45
GetJspMethod · 0.45

Tested by

no test coverage detected