@@ -907,7 +907,7 @@ String *Item_func_json_unquote::read_json(json_engine_t *je)
907
907
String *Item_func_json_unquote::val_str (String *str)
908
908
{
909
909
json_engine_t je;
910
- int c_len;
910
+ int c_len= JSON_ERROR_OUT_OF_SPACE ;
911
911
String *js;
912
912
913
913
if (!(js= read_json (&je)))
@@ -930,7 +930,15 @@ String *Item_func_json_unquote::val_str(String *str)
930
930
return str;
931
931
932
932
error:
933
- report_json_error (js, &je, 0 );
933
+ if (current_thd)
934
+ {
935
+ if (c_len == JSON_ERROR_OUT_OF_SPACE)
936
+ my_error (ER_OUTOFMEMORY, MYF (0 ), je.value_len );
937
+ else if (c_len == JSON_ERROR_ILLEGAL_SYMBOL)
938
+ push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
939
+ ER_JSON_BAD_CHR, ER_THD (current_thd, ER_JSON_BAD_CHR),
940
+ 0 , " unquote" , 0 );
941
+ }
934
942
return js;
935
943
}
936
944
@@ -4195,9 +4203,14 @@ int Arg_comparator::compare_json_str_basic(Item *j, Item *s)
4195
4203
(uchar *) (value2.ptr () + je.value_len ))) < 0 )
4196
4204
{
4197
4205
if (current_thd)
4198
- push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
4199
- ER_JSON_BAD_CHR, ER_THD (current_thd, ER_JSON_BAD_CHR),
4200
- 0 , " comparison" , (int )((const char *) je.s .c_str - js->ptr ()));
4206
+ {
4207
+ if (c_len == JSON_ERROR_OUT_OF_SPACE)
4208
+ my_error (ER_OUTOFMEMORY, MYF (0 ), je.value_len );
4209
+ else if (c_len == JSON_ERROR_ILLEGAL_SYMBOL)
4210
+ push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
4211
+ ER_JSON_BAD_CHR, ER_THD (current_thd, ER_JSON_BAD_CHR),
4212
+ 0 , " comparison" , (int )((const char *) je.s .c_str - js->ptr ()));
4213
+ }
4201
4214
goto error;
4202
4215
}
4203
4216
@@ -4254,10 +4267,15 @@ int Arg_comparator::compare_e_json_str_basic(Item *j, Item *s)
4254
4267
(uchar *) (value1.ptr () + value_len))) < 0 )
4255
4268
{
4256
4269
if (current_thd)
4257
- push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
4258
- ER_JSON_BAD_CHR, ER_THD (current_thd, ER_JSON_BAD_CHR),
4259
- 0 , " equality comparison" , 0 );
4260
- return 1 ;
4270
+ {
4271
+ if (c_len == JSON_ERROR_OUT_OF_SPACE)
4272
+ my_error (ER_OUTOFMEMORY, MYF (0 ), value_len);
4273
+ else if (c_len == JSON_ERROR_ILLEGAL_SYMBOL)
4274
+ push_warning_printf (current_thd, Sql_condition::WARN_LEVEL_WARN,
4275
+ ER_JSON_BAD_CHR, ER_THD (current_thd, ER_JSON_BAD_CHR),
4276
+ 0 , " equality comparison" , 0 );
4277
+ }
4278
+ return 1 ;
4261
4279
}
4262
4280
value1.length (c_len);
4263
4281
res1= &value1;
0 commit comments