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

Method CheckPath

storage/connect/bsonudf.cpp:1016–1051  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1014/* CheckPath: Checks whether the path exists in the document. */
1015/*********************************************************************************/
1016my_bool BJNX::CheckPath(PGLOBAL g)
1017{
1018 PBVAL val = NULL;
1019 PBVAL row = Row;
1020
1021 for (int i = 0; i < Nod && row; i++) {
1022 val = NULL;
1023
1024 if (Nodes[i].Op == OP_NUM || Nodes[i].Op == OP_XX) {
1025 } else switch (row->Type) {
1026 case TYPE_JOB:
1027 if (Nodes[i].Key)
1028 val = GetKeyValue(row, Nodes[i].Key);
1029
1030 break;
1031 case TYPE_JAR:
1032 if (!Nodes[i].Key)
1033 if (Nodes[i].Op == OP_EQ || Nodes[i].Op == OP_LE)
1034 val = GetArrayValue(row, Nodes[i].Rank);
1035
1036 break;
1037 case TYPE_JVAL:
1038 val = row;
1039 break;
1040 default:
1041 snprintf(g->Message, sizeof(g->Message), "Invalid row JSON type %d", row->Type);
1042 } // endswitch Type
1043
1044 if (i < Nod-1)
1045 if (!(row = (IsJson(val)) ? val : NULL))
1046 val = NULL;
1047
1048 } // endfor i
1049
1050 return (val != NULL);
1051} // end of CheckPath
1052
1053/*********************************************************************************/
1054/* Check if a path was specified and set jvp according to it. */

Callers 12

bson_array_addFunction · 0.45
bson_array_deleteFunction · 0.45
bson_object_addFunction · 0.45
bson_object_deleteFunction · 0.45
bsoncontains_pathFunction · 0.45
bson_fileFunction · 0.45
bbin_array_addFunction · 0.45
bbin_object_addFunction · 0.45
bbin_array_deleteFunction · 0.45
bbin_object_deleteFunction · 0.45
bbin_get_itemFunction · 0.45
bbin_fileFunction · 0.45

Calls 2

IsJsonFunction · 0.85
MakePSZFunction · 0.85

Tested by

no test coverage detected