Skip to content

Commit 3e14f9f

Browse files
committed
WL#7909: Server side JSON functions
WL#8132: JSON datatype and binary storage format WL#8170: Expression analyzer for GC WL#8249: JSON comparator WL#8539: Ordering of scalar JSON values Backported from mysql-trunk to mysql-5.7.
1 parent a225153 commit 3e14f9f

File tree

281 files changed

+98202
-9288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+98202
-9288
lines changed

client/mysql.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,24 @@ static COMMANDS commands[] = {
944944
{ "ISNULL", 0, 0, 0, ""},
945945
{ "IS_FREE_LOCK", 0, 0, 0, ""},
946946
{ "IS_USED_LOCK", 0, 0, 0, ""},
947+
{ "JSON_APPEND", 0, 0, 0, ""},
948+
{ "JSON_ARRAY", 0, 0, 0, ""},
949+
{ "JSON_CONTAINS", 0, 0, 0, ""},
950+
{ "JSON_DEPTH", 0, 0, 0, ""},
951+
{ "JSON_EXTRACT", 0, 0, 0, ""},
952+
{ "JSON_INSERT", 0, 0, 0, ""},
953+
{ "JSON_KEYS", 0, 0, 0, ""},
954+
{ "JSON_LENGTH", 0, 0, 0, ""},
955+
{ "JSON_MERGE", 0, 0, 0, ""},
956+
{ "JSON_QUOTE", 0, 0, 0, ""},
957+
{ "JSON_REPLACE", 0, 0, 0, ""},
958+
{ "JSON_ROWOBJECT", 0, 0, 0, ""},
959+
{ "JSON_SEARCH", 0, 0, 0, ""},
960+
{ "JSON_SET", 0, 0, 0, ""},
961+
{ "JSON_TYPE", 0, 0, 0, ""},
962+
{ "JSON_UNQUOTE", 0, 0, 0, ""},
963+
{ "JSON_VALID", 0, 0, 0, ""},
964+
{ "JSON_CONTAINS_PATH", 0, 0, 0, ""},
947965
{ "LAST_INSERT_ID", 0, 0, 0, ""},
948966
{ "ISSIMPLE", 0, 0, 0, ""},
949967
{ "LAST_DAY", 0, 0, 0, ""},
@@ -3749,6 +3767,7 @@ static const char *fieldtype2str(enum enum_field_types type)
37493767
case MYSQL_TYPE_FLOAT: return "FLOAT";
37503768
case MYSQL_TYPE_GEOMETRY: return "GEOMETRY";
37513769
case MYSQL_TYPE_INT24: return "INT24";
3770+
case MYSQL_TYPE_JSON: return "JSON";
37523771
case MYSQL_TYPE_LONG: return "LONG";
37533772
case MYSQL_TYPE_LONGLONG: return "LONGLONG";
37543773
case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB";

extra/RAPIDJSON-README

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15+
16+
----
17+
18+
The rapidjson library included in this directory is based on
19+
https://github.com/miloyip/rapidjson, upstream commit
20+
3a4835e080d213c60842f58f207991fbb1c97f74.
21+
22+
There are two changes made to the library:
23+
24+
1) Two lines has been added to reader.h, which fixes an assertion in the library
25+
when a JSON document contains illegaly escaped unicode characters. See
26+
upstream commit b7e34100ed167b8134b41fcff0918895dd4e61fb for the changes.
27+
28+
2) Rapidjson-specific changes in commit 91153f3385c4917a215aa4c7818b3f6265608286
29+
has been applied, so that negative zero is handled properly.

extra/rapidjson/.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
language: cpp
2+
3+
compiler:
4+
- clang
5+
- gcc
6+
7+
env:
8+
matrix:
9+
- CONF=debug ARCH=x86_64
10+
- CONF=release ARCH=x86_64
11+
- CONF=debug ARCH=x86
12+
- CONF=release ARCH=x86
13+
global:
14+
- ARCH_FLAGS_x86='-m32'
15+
- ARCH_FLAGS_x86_64=''
16+
- GITHUB_REPO='miloyip/rapidjson'
17+
- secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="
18+
19+
before_install:
20+
- sudo apt-get update -qq
21+
- sudo apt-get install -qq cmake doxygen valgrind
22+
- if [ "$ARCH" = "x86" ]; then sudo apt-get install -qq g++-multilib libc6-dbg:i386; fi
23+
24+
install: true
25+
26+
before_script:
27+
# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
28+
# exposed by merging PR#163 (using -march=native)
29+
- sed -i 's/march=native/msse4.2/' CMakeLists.txt
30+
- mkdir build
31+
- >
32+
eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
33+
(cd build && cmake
34+
-DRAPIDJSON_HAS_STDSTRING=ON
35+
-DCMAKE_VERBOSE_MAKEFILE=ON
36+
-DCMAKE_BUILD_TYPE=$CONF
37+
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS" ..)
38+
39+
script:
40+
- cd build
41+
- make tests
42+
- make examples
43+
- ctest -V `[ "$CONF" = "release" ] || echo "-E perftest"`
44+
- make travis_doc

extra/rapidjson/CMakeLists.txt

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2+
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
3+
4+
PROJECT(RapidJSON CXX)
5+
6+
set(LIB_MAJOR_VERSION "0")
7+
set(LIB_MINOR_VERSION "12")
8+
set(LIB_PATCH_VERSION "0")
9+
set(LIB_VERSION_STRING "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_PATCH_VERSION}")
10+
11+
# compile in release with debug info mode by default
12+
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build Type")
13+
14+
# Build all binaries in a separate directory
15+
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
16+
17+
option(RAPIDJSON_BUILD_DOC "Build rapidjson documentation." ON)
18+
option(RAPIDJSON_BUILD_EXAMPLES "Build rapidjson examples." ON)
19+
option(RAPIDJSON_BUILD_TESTS "Build rapidjson perftests and unittests." ON)
20+
21+
option(RAPIDJSON_HAS_STDSTRING "" OFF)
22+
if(RAPIDJSON_HAS_STDSTRING)
23+
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
24+
endif()
25+
26+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
27+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra")
28+
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra")
30+
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
31+
add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
32+
endif()
33+
34+
#add extra search paths for libraries and includes
35+
SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
36+
SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "Directory where lib will install")
37+
SET(DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "Path to the documentation")
38+
39+
IF(UNIX OR CYGWIN)
40+
SET(_CMAKE_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}")
41+
ELSEIF(WIN32)
42+
SET(_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake")
43+
ENDIF()
44+
SET(CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" CACHE PATH "The directory cmake fiels are installed in")
45+
46+
include_directories(${CMAKE_SOURCE_DIR}/include)
47+
48+
if(RAPIDJSON_BUILD_DOC)
49+
add_subdirectory(doc)
50+
endif()
51+
52+
add_custom_target(travis_doc)
53+
add_custom_command(TARGET travis_doc
54+
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/travis-doxygen.sh)
55+
56+
if(RAPIDJSON_BUILD_EXAMPLES)
57+
add_subdirectory(example)
58+
endif()
59+
60+
if(RAPIDJSON_BUILD_TESTS)
61+
if(MSVC11)
62+
# required for VS2012 due to missing support for variadic templates
63+
add_definitions(-D_VARIADIC_MAX=10)
64+
endif(MSVC11)
65+
add_subdirectory(test)
66+
include(CTest)
67+
endif()
68+
69+
# pkg-config
70+
IF (UNIX OR CYGWIN)
71+
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc.in
72+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
73+
@ONLY)
74+
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
75+
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig"
76+
COMPONENT pkgconfig)
77+
ENDIF()
78+
79+
install(FILES readme.md
80+
DESTINATION "${DOC_INSTALL_DIR}"
81+
COMPONENT doc)
82+
83+
install(DIRECTORY include/rapidjson
84+
DESTINATION "${INCLUDE_INSTALL_DIR}"
85+
COMPONENT dev)
86+
87+
install(DIRECTORY example/
88+
DESTINATION "${DOC_INSTALL_DIR}/examples"
89+
COMPONENT examples)
90+
91+
# Provide config and version files to be used by other applications
92+
# ===============================
93+
94+
export(PACKAGE ${PROJECT_NAME})
95+
96+
# cmake-modules
97+
CONFIGURE_FILE(${PROJECT_NAME}Config.cmake.in
98+
${PROJECT_NAME}Config.cmake
99+
@ONLY)
100+
CONFIGURE_FILE(${PROJECT_NAME}ConfigVersion.cmake.in
101+
${PROJECT_NAME}ConfigVersion.cmake
102+
@ONLY)
103+
INSTALL(FILES
104+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
105+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
106+
DESTINATION "${CMAKE_INSTALL_DIR}"
107+
COMPONENT dev)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
SET(GTEST_SEARCH_PATH
2+
"${GTEST_SOURCE_DIR}"
3+
"${CMAKE_SOURCE_DIR}/thirdparty/gtest")
4+
5+
IF(UNIX)
6+
LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
7+
ENDIF()
8+
9+
FIND_PATH(GTEST_SOURCE_DIR
10+
NAMES CMakeLists.txt src/gtest_main.cc
11+
PATHS ${GTEST_SEARCH_PATH})
12+
13+
# Debian installs gtest include directory in /usr/include, thus need to look
14+
# for include directory separately from source directory.
15+
FIND_PATH(GTEST_INCLUDE_DIR
16+
NAMES gtest/gtest.h
17+
PATH_SUFFIXES include
18+
PATHS ${GTEST_SEARCH_PATH})
19+
20+
find_package_handle_standard_args(GTestSrc DEFAULT_MSG
21+
GTEST_SOURCE_DIR
22+
GTEST_INCLUDE_DIR)

extra/rapidjson/RapidJSON.pc.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
includedir=@INCLUDE_INSTALL_DIR@
2+
3+
Name: @PROJECT_NAME@
4+
Description: A fast JSON parser/generator for C++ with both SAX/DOM style API
5+
Version: @LIB_VERSION_STRING@
6+
URL: https://github.com/miloyip/rapidjson
7+
Cflags: -I${includedir}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
get_filename_component(RAPIDJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
2+
set(RAPIDJSON_INCLUDE_DIRS "@INCLUDE_INSTALL_DIR@")
3+
message(STATUS "RapidJSON found. Headers: ${RAPIDJSON_INCLUDE_DIRS}")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SET(PACKAGE_VERSION "@LIB_VERSION_STRING@")
2+
3+
IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
4+
SET(PACKAGE_VERSION_EXACT "true")
5+
ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
6+
IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
7+
SET(PACKAGE_VERSION_COMPATIBLE "true")
8+
ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
9+
SET(PACKAGE_VERSION_UNSUITABLE "true")
10+
ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)

extra/rapidjson/appveyor.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 0.12.{build}
2+
3+
configuration:
4+
- Debug
5+
- Release
6+
7+
environment:
8+
matrix:
9+
- VS_VERSION: 11
10+
VS_PLATFORM: win32
11+
- VS_VERSION: 11
12+
VS_PLATFORM: x64
13+
- VS_VERSION: 12
14+
VS_PLATFORM: win32
15+
- VS_VERSION: 12
16+
VS_PLATFORM: x64
17+
18+
before_build:
19+
- git submodule update --init --recursive
20+
- cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DBUILD_SHARED_LIBS=true -Wno-dev
21+
22+
build:
23+
project: Build\VS\RapidJSON.sln
24+
parallel: true
25+
verbosity: minimal
26+
27+
test_script:
28+
- cd Build\VS && if %CONFIGURATION%==Debug (ctest --verbose -E perftest --build-config %CONFIGURATION%) else (ctest --verbose --build-config %CONFIGURATION%)
368 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"en":"I can eat glass and it doesn't hurt me.",
3+
"zh-Hant":"我能吞下玻璃而不傷身體。",
4+
"zh-Hans":"我能吞下玻璃而不伤身体。",
5+
"ja":"私はガラスを食べられます。それは私を傷つけません。",
6+
"ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"
7+
}
368 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"en":"I can eat glass and it doesn't hurt me.",
3+
"zh-Hant":"我能吞下玻璃而不傷身體。",
4+
"zh-Hans":"我能吞下玻璃而不伤身体。",
5+
"ja":"私はガラスを食べられます。それは私を傷つけません。",
6+
"ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"
7+
}
736 Bytes
Binary file not shown.
740 Bytes
Binary file not shown.
736 Bytes
Binary file not shown.
740 Bytes
Binary file not shown.

extra/rapidjson/bin/encodings/utf8bom.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"en":"I can eat glass and it doesn't hurt me.",
33
"zh-Hant":"我能吞下玻璃而不傷身體。",
44
"zh-Hans":"我能吞下玻璃而不伤身体。",

0 commit comments

Comments
 (0)