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

Function CheckPath

storage/connect/jsonudf.cpp:1393–1420  ·  view source on GitHub ↗

/ Check if a path was specified and set jvp according to it. */ /

Source from the content-addressed store, hash-verified

1391/* Check if a path was specified and set jvp according to it. */
1392/*********************************************************************************/
1393static my_bool CheckPath(PGLOBAL g, UDF_ARGS *args, PJSON jsp, PJVAL& jvp, int n)
1394{
1395 for (uint i = n; i < args->arg_count; i++)
1396 if (args->arg_type[i] == STRING_RESULT && args->args[i]) {
1397 // A path to a subset of the json tree is given
1398 char *path = MakePSZ(g, args, i);
1399
1400 if (path) {
1401 PJSNX jsx = new(g)JSNX(g, jsp, TYPE_STRING);
1402
1403 if (jsx->SetJpath(g, path))
1404 return true;
1405
1406 if (!(jvp = jsx->GetJson(g))) {
1407 snprintf(g->Message, sizeof(g->Message), "No sub-item at '%s'", path);
1408 return true;
1409 } // endif jvp
1410
1411 } else {
1412 snprintf(g->Message, sizeof(g->Message), "Path argument is null");
1413 return true;
1414 } // endif path
1415
1416 break;
1417 } // endif type
1418
1419 return false;
1420} // end of CheckPath
1421
1422/*********************************************************************************/
1423/* Make the result according to the first argument type. */

Callers 10

json_array_addFunction · 0.85
json_array_deleteFunction · 0.85
json_object_addFunction · 0.85
json_object_deleteFunction · 0.85
json_fileFunction · 0.85
jbin_array_addFunction · 0.85
jbin_array_deleteFunction · 0.85
jbin_object_addFunction · 0.85
jbin_object_deleteFunction · 0.85
jbin_fileFunction · 0.85

Calls 3

MakePSZFunction · 0.85
SetJpathMethod · 0.45
GetJsonMethod · 0.45

Tested by

no test coverage detected