diff options
Diffstat (limited to 'sql/item_jsonfunc.cc')
-rw-r--r-- | sql/item_jsonfunc.cc | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 7aa9f2917ea..2fd2f459d0b 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -150,10 +150,12 @@ int json_path_parts_compare( { int res, res2; - long arbitrary_var; - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); DBUG_EXECUTE_IF("json_check_min_stack_requirement", - {ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); + { + long arbitrary_var; + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); + ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); + }); if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) return 1; @@ -1096,13 +1098,15 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to) case JSON_VALUE_OBJECT: case JSON_VALUE_ARRAY: case JSON_VALUE_FALSE: - case JSON_VALUE_NULL: case JSON_VALUE_UNINITALIZED: - break; + // TODO: fix: NULL should be NULL + case JSON_VALUE_NULL: + int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to); + return to; }; } - int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to); - return to; + DBUG_ASSERT(null_value); + return 0; } @@ -1140,10 +1144,12 @@ static int check_contains(json_engine_t *js, json_engine_t *value) { json_engine_t loc_js; bool set_js; - long arbitrary_var; - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); DBUG_EXECUTE_IF("json_check_min_stack_requirement", - {ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); + { + long arbitrary_var; + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); + ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); + }); if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) return 1; @@ -2106,10 +2112,12 @@ err_return: static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2) { - long arbitrary_var; - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); DBUG_EXECUTE_IF("json_check_min_stack_requirement", - {ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); + { + long arbitrary_var; + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); + ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); + }); if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) return 1; @@ -2445,10 +2453,12 @@ static int copy_value_patch(String *str, json_engine_t *je) static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2, bool *empty_result) { - long arbitrary_var; - long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); DBUG_EXECUTE_IF("json_check_min_stack_requirement", - {ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);}); + { + long arbitrary_var; + long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var)); + ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE); + }); if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL)) return 1; |