| 3565 | } // end of jsonget_string_init |
| 3566 | |
| 3567 | char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, |
| 3568 | unsigned long *res_length, uchar *is_null, uchar *) |
| 3569 | { |
| 3570 | char *p, *path, *str = NULL; |
| 3571 | PJSON jsp; |
| 3572 | PJSNX jsx; |
| 3573 | PJVAL jvp; |
| 3574 | PGLOBAL g = (PGLOBAL)initid->ptr; |
| 3575 | |
| 3576 | if (g->N) { |
| 3577 | str = (char*)g->Activityp; |
| 3578 | goto err; |
| 3579 | } else if (initid->const_item) |
| 3580 | g->N = 1; |
| 3581 | |
| 3582 | try { |
| 3583 | if (!g->Xchk) { |
| 3584 | if (CheckMemory(g, initid, args, 1, true)) { |
| 3585 | PUSH_WARNING("CheckMemory error"); |
| 3586 | goto err; |
| 3587 | } else |
| 3588 | jvp = MakeValue(g, args, 0); |
| 3589 | |
| 3590 | if ((p = jvp->GetString(g))) { |
| 3591 | if (!(jsp = ParseJson(g, p, strlen(p)))) { |
| 3592 | PUSH_WARNING(g->Message); |
| 3593 | goto err; |
| 3594 | } // endif jsp |
| 3595 | |
| 3596 | } else |
| 3597 | jsp = jvp->GetJson(); |
| 3598 | |
| 3599 | if (g->Mrr) { // First argument is a constant |
| 3600 | g->Xchk = jsp; |
| 3601 | JsonMemSave(g); |
| 3602 | } // endif Mrr |
| 3603 | |
| 3604 | } else |
| 3605 | jsp = (PJSON)g->Xchk; |
| 3606 | |
| 3607 | path = MakePSZ(g, args, 1); |
| 3608 | jsx = JsnxNew(g, jsp, TYPE_STRING, initid->max_length); |
| 3609 | |
| 3610 | if (!jsx || jsx->SetJpath(g, path)) { |
| 3611 | PUSH_WARNING(g->Message); |
| 3612 | goto err; |
| 3613 | } // endif SetJpath |
| 3614 | |
| 3615 | jsx->ReadValue(g); |
| 3616 | |
| 3617 | if (!jsx->GetValue()->IsNull()) |
| 3618 | str = jsx->GetValue()->GetCharValue(); |
| 3619 | |
| 3620 | if (initid->const_item) |
| 3621 | // Keep result of constant function |
| 3622 | g->Activityp = (PACTIVITY)str; |
| 3623 | |
| 3624 | } catch (int n) { |
nothing calls this directly
no test coverage detected