json array element end handler for populate_array_json() */
| 2669 | |
| 2670 | /* json array element end handler for populate_array_json() */ |
| 2671 | static void |
| 2672 | populate_array_element_end(void *_state, bool isnull) |
| 2673 | { |
| 2674 | PopulateArrayState *state = (PopulateArrayState *) _state; |
| 2675 | PopulateArrayContext *ctx = state->ctx; |
| 2676 | int ndim = state->lex->lex_level; |
| 2677 | |
| 2678 | Assert(ctx->ndims > 0); |
| 2679 | |
| 2680 | if (ndim == ctx->ndims) |
| 2681 | { |
| 2682 | JsValue jsv; |
| 2683 | |
| 2684 | jsv.is_json = true; |
| 2685 | jsv.val.json.type = state->element_type; |
| 2686 | |
| 2687 | if (isnull) |
| 2688 | { |
| 2689 | Assert(jsv.val.json.type == JSON_TOKEN_NULL); |
| 2690 | jsv.val.json.str = NULL; |
| 2691 | jsv.val.json.len = 0; |
| 2692 | } |
| 2693 | else if (state->element_scalar) |
| 2694 | { |
| 2695 | jsv.val.json.str = state->element_scalar; |
| 2696 | jsv.val.json.len = -1; /* null-terminated */ |
| 2697 | } |
| 2698 | else |
| 2699 | { |
| 2700 | jsv.val.json.str = state->element_start; |
| 2701 | jsv.val.json.len = (state->lex->prev_token_terminator - |
| 2702 | state->element_start) * sizeof(char); |
| 2703 | } |
| 2704 | |
| 2705 | populate_array_element(ctx, ndim, &jsv); |
| 2706 | } |
| 2707 | } |
| 2708 | |
| 2709 | /* json scalar handler for populate_array_json() */ |
| 2710 | static void |
nothing calls this directly
no test coverage detected