summaryrefslogtreecommitdiff
path: root/include/json_lib.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.6' into 10.7Oleksandr Byelkin2022-02-041-0/+1
|\
| * MDEV-24909 JSON functions don't respect KILL QUERY / max_statement_time limitSergei Golubchik2022-01-301-0/+1
| | | | | | | | | | | | pass the pointer to thd->killed down to the json library, check it while scanning, use thd->check_killed() to generate the proper error message
* | Add json_normalize function to json_libEric Herman2021-07-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | This patch implements a library for normalizing json documents. The algorithm is: * Recursively sort json keys according to utf8mb4_bin collation. * Normalize numbers to be of the form [-]<digit>.<frac>E<exponent> * All unneeded whitespace and line endings are removed. * Arrays are not sorted. Co-authored-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
* | fix json typo s/UNINITALIZED/UNINITIALIZED/Eric Herman2021-07-211-1/+1
|/
* Fix all warnings given by UBSANMonty2021-04-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The easiest way to compile and test the server with UBSAN is to run: ./BUILD/compile-pentium64-ubsan and then run mysql-test-run. After this commit, one should be able to run this without any UBSAN warnings. There is still a few compiler warnings that should be fixed at some point, but these do not expose any real bugs. The 'special' cases where we disable, suppress or circumvent UBSAN are: - ref10 source (as here we intentionally do some shifts that UBSAN complains about. - x86 version of optimized int#korr() methods. UBSAN do not like unaligned memory access of integers. Fixed by using byte_order_generic.h when compiling with UBSAN - We use smaller thread stack with ASAN and UBSAN, which forced me to disable a few tests that prints the thread stack size. - Verifying class types does not work for shared libraries. I added suppression in mysql-test-run.pl for this case. - Added '#ifdef WITH_UBSAN' when using integer arithmetic where it is safe to have overflows (two cases, in item_func.cc). Things fixed: - Don't left shift signed values (byte_order_generic.h, mysqltest.c, item_sum.cc and many more) - Don't assign not non existing values to enum variables. - Ensure that bool and enum values are properly initialized in constructors. This was needed as UBSAN checks that these types has correct values when one copies an object. (gcalc_tools.h, ha_partition.cc, item_sum.cc, partition_element.h ...) - Ensure we do not called handler functions on unallocated objects or deleted objects. (events.cc, sql_acl.cc). - Fixed bugs in Item_sp::Item_sp() where we did not call constructor on Query_arena object. - Fixed several cast of objects to an incompatible class! (Item.cc, Item_buff.cc, item_timefunc.cc, opt_subselect.cc, sql_acl.cc, sql_select.cc ...) - Ensure we do not do integer arithmetic that causes over or underflows. This includes also ++ and -- of integers. (Item_func.cc, Item_strfunc.cc, item_timefunc.cc, sql_base.cc ...) - Added JSON_VALUE_UNITIALIZED to json_value_types and ensure that value_type is initialized to this instead of to -1, which is not a valid enum value for json_value_types. - Ensure we do not call memcpy() when second argument could be null. - Fixed that Item_func_str::make_empty_result() creates an empty string instead of a null string (safer as it ensures we do not do arithmetic on null strings). Other things: - Changed struct st_position to an OBJECT and added an initialization function to it to ensure that we do not copy or use uninitialized members. The change to a class was also motived that we used "struct st_position" and POSITION randomly trough the code which was confusing. - Notably big rewrite in sql_acl.cc to avoid using deleted objects. - Changed in sql_partition to use '^' instead of '-'. This is safe as the operator is either 0 or 0x8000000000000000ULL. - Added check for select_nr < INT_MAX in JOIN::build_explain() to avoid bug when get_select() could return NULL. - Reordered elements in POSITION for better alignment. - Changed sql_test.cc::print_plan() to use pointers instead of objects. - Fixed bug in find_set() where could could execute '1 << -1'. - Added variable have_sanitizer, used by mtr. (This variable was before only in 10.5 and up). It can now have one of two values: ASAN or UBSAN. - Moved ~Archive_share() from ha_archive.cc to ha_archive.h and marked it virtual. This was an effort to get UBSAN to work with loaded storage engines. I kept the change as the new place is better. - Added in CONNECT engine COLBLK::SetName(), to get around a wrong cast in tabutil.cpp. - Added HAVE_REPLICATION around usage of rgi_slave, to get embedded server to compile with UBSAN. (Patch from Marko). - Added #ifdef for powerpc64 to avoid a bug in old gcc versions related to integer arithmetic. Changes that should not be needed but had to be done to suppress warnings from UBSAN: - Added static_cast<<uint16_t>> around shift to get rid of a LOT of compiler warnings when using UBSAN. - Had to change some '/' of 2 base integers to shift to get rid of some compile time warnings. Reviewed by: - Json changes: Alexey Botchkov - Charset changes in ctype-uca.c: Alexander Barkov - InnoDB changes & Embedded server: Marko Mäkelä - sql_acl.cc changes: Vicențiu Ciorbaru - build_explain() changes: Sergey Petrunia
* MDEV-5313 Improving audit API.Alexey Botchkov2019-01-181-0/+5
| | | | | json_locate_key() implemented. get rid of 'key_len' argument in functions.
* MDEV-5313 Improving audit api.Alexey Botchkov2019-01-171-4/+0
| | | | | JSON api implementations and tests pushed. sql_acl.cc fixed with the new function names.
* json helpersSergei Golubchik2018-12-121-1/+5
|
* MDEV-5313 Improving audit api.Alexey Botchkov2018-12-121-5/+5
| | | | Service added to handle json.
* Merge branch '10.2' into 10.3Sergei Golubchik2018-09-281-0/+6
|\
| * MDEV-17121 JSON_ARRAY_APPEND.Alexey Botchkov2018-09-111-0/+6
| | | | | | | | Extra comma added to the result when an json array is empty.
* | Misc. typosluz.paz2018-04-051-1/+1
|/ | | | Found via `codespell -i 3 -w --skip="./debian/po" -I ../mariadb-server-word-whitelist.txt ./cmake/ ./debian/ ./Docs/ ./include/ ./man/ ./plugin/ ./strings/`
* MDEV-11856 json_search doesn't search for values with double quotesAlexey Botchkov2017-03-141-0/+1
| | | | | | | | character ("). The my_wildcmp function doesn't expect the string parameter to have escapements, only the template. So the string should be unescaped if necessary.
* MDEV-11557 port MySQL-5.7 JSON tests to MariaDB.Alexey Botchkov2017-02-061-1/+6
| | | | Fixes for issues found.
* MDEV-11557 port MySQL-5.7 JSON tests to MariaDB.Alexey Botchkov2017-01-241-2/+23
| | | | json_no_table.test ported.
* MDEV-11562 Assertion `js->state == JST_VALUE' failed in ↵Alexey Botchkov2016-12-161-5/+19
| | | | | | | | check_contains(json_engine_t*, json_engine_t*). check_contains() fixed. When an item of an array is a complex structure, it can be half-read after the end of the recursive check_contains() call. So we just manually get to it's ending.
* MDEV-11470 JSON_KEYS accepts arguments in invalid format.Alexey Botchkov2016-12-131-0/+1
| | | | Now JSON functions return warnings if arguments are invalid.
* MDEV-11453 JSON_CONTAINS returns incorrect values.Alexey Botchkov2016-12-111-0/+1
| | | | The weird logic of json_contains was implemented.
* MDEV-11469 JSON_SEARCH returns incorrect results.Alexey Botchkov2016-12-091-6/+15
| | | | Support for '**' in json path expressions added.
* MDEV-11461 JSON_TYPE does not recognize integer/double types.Alexey Botchkov2016-12-051-0/+11
| | | | Integer/Double recognition added.
* MDEV-9143 JSON_xxx functions.Alexey Botchkov2016-11-151-0/+7
| | | | | The rest of mysql/json functions implemented. CAST AS JSON implemented.
* MDEV-9143 JSON_xxx functions.Alexey Botchkov2016-10-191-0/+356
strings/json_lib.c added as a JSON library. SQL frunction added with sql/item_jsonfunc.h/cc