/ CheckPath: Checks whether the path exists in the document. */ /
| 1014 | /* CheckPath: Checks whether the path exists in the document. */ |
| 1015 | /*********************************************************************************/ |
| 1016 | my_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. */ |
no test coverage detected