| 804 | } |
| 805 | |
| 806 | bool Json_path_extractor::extract(MEM_ROOT *mem_root, String *str, |
| 807 | Item *item_js, Item *item_jp, |
| 808 | CHARSET_INFO *cs, |
| 809 | MEM_ROOT_DYNAMIC_ARRAY *array_counters, |
| 810 | const char *func_name, bool allow_wildcard) |
| 811 | { |
| 812 | String *js= item_js->val_json(&tmp_js); |
| 813 | json_path_step_t *tmp_ptr= NULL; |
| 814 | int error= 0; |
| 815 | |
| 816 | if (!parsed) |
| 817 | { |
| 818 | String *s_p= item_jp->val_str(&tmp_path); |
| 819 | |
| 820 | if (allow_wildcard) |
| 821 | { |
| 822 | if (s_p && |
| 823 | json_path_setup(&p, s_p->charset(), (const uchar *) s_p->ptr(), |
| 824 | (const uchar *) s_p->ptr() + s_p->length())) |
| 825 | error= true; |
| 826 | } |
| 827 | else |
| 828 | { |
| 829 | if (s_p && |
| 830 | path_setup_nwc(&p, s_p->charset(), (const uchar *) s_p->ptr(), |
| 831 | (const uchar *) s_p->ptr() + s_p->length())) |
| 832 | error= true; |
| 833 | } |
| 834 | |
| 835 | if (error) |
| 836 | { |
| 837 | report_path_error_ex(s_p->ptr(), &p, func_name, 1, |
| 838 | Sql_condition::WARN_LEVEL_WARN); |
| 839 | return true; |
| 840 | } |
| 841 | |
| 842 | parsed= constant; |
| 843 | } |
| 844 | |
| 845 | if (item_js->null_value || item_jp->null_value) |
| 846 | return true; |
| 847 | |
| 848 | json_scan_start(&je, js->charset(), (const uchar*)js->ptr(), |
| 849 | (const uchar*)js->end()); |
| 850 | str->length(0); |
| 851 | str->set_charset(cs); |
| 852 | |
| 853 | cur_step= &p.steps; |
| 854 | tmp_ptr= (json_path_step_t*)(p.steps.buffer); |
| 855 | continue_search: |
| 856 | if (json_find_path(&je, &p, &tmp_ptr, array_counters)) |
| 857 | goto error_return; |
| 858 | |
| 859 | if (json_read_value(&je)) |
| 860 | goto error_return; |
| 861 | |
| 862 | if (je.value_type == JSON_VALUE_NULL) |
| 863 | goto error_return; |
nothing calls this directly
no test coverage detected