Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1fad491c
Commit
1fad491c
authored
Aug 07, 2017
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.2' of github.com:MariaDB/server into 10.2
parents
0b30ce4f
dcdc1c6d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
118 additions
and
13 deletions
+118
-13
mysql-test/r/func_json.result
mysql-test/r/func_json.result
+6
-0
mysql-test/r/gis-json.result
mysql-test/r/gis-json.result
+15
-0
mysql-test/t/func_json.test
mysql-test/t/func_json.test
+6
-0
mysql-test/t/gis-json.test
mysql-test/t/gis-json.test
+7
-0
sql/item_geofunc.cc
sql/item_geofunc.cc
+32
-1
sql/spatial.cc
sql/spatial.cc
+45
-7
sql/spatial.h
sql/spatial.h
+1
-0
storage/innobase/ibuf/ibuf0ibuf.cc
storage/innobase/ibuf/ibuf0ibuf.cc
+1
-2
storage/innobase/log/log0log.cc
storage/innobase/log/log0log.cc
+1
-2
storage/innobase/mtr/mtr0mtr.cc
storage/innobase/mtr/mtr0mtr.cc
+3
-0
strings/json_lib.c
strings/json_lib.c
+1
-1
No files found.
mysql-test/r/func_json.result
View file @
1fad491c
...
...
@@ -642,3 +642,9 @@ SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' )
NULL
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
NULL
mysql-test/r/gis-json.result
View file @
1fad491c
...
...
@@ -74,6 +74,21 @@ POINT(5.3 15)
SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4))
POINT(5.3 15)
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2)
{"type": "Point", "coordinates": [5.36, 7.27]}
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1)
{"type": "Point", "coordinates": [5.4, 7.3]}
SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10)
{"type": "Point", "coordinates": [5.363, 7.266]}
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1)
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5)
{"bbox": [10, 11, 10, 11], "type": "Point", "coordinates": [10, 11]}
#
# End of 10.2 tests
#
mysql-test/t/func_json.test
View file @
1fad491c
...
...
@@ -296,3 +296,9 @@ INSERT INTO t1 VALUES (0);
SELECT
JSON_KEYS
(
f
)
FROM
t1
ORDER
BY
1
;
DROP
TABLE
t1
;
#
# MDEV-12324 Wrong result (phantom array value) on JSON_EXTRACT.
#
SELECT
JSON_EXTRACT
(
'{"foo":"bar"}'
,
'$[*].*'
);
SELECT
JSON_EXTRACT
(
'{"foo":"bar"}'
,
'$[*]'
);
mysql-test/t/gis-json.test
View file @
1fad491c
...
...
@@ -33,6 +33,13 @@ SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.
SELECT
ST_AsText
(
ST_GeomFromGeoJSON
(
'{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}'
,
3
));
SELECT
ST_AsText
(
ST_GeomFromGeoJSON
(
'{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}'
,
4
));
SELECT
ST_AsGeoJSON
(
ST_GeomFromText
(
'POINT(5.363 7.266)'
),
2
);
SELECT
ST_AsGeoJSON
(
ST_GeomFromText
(
'POINT(5.363 7.266)'
),
1
);
SELECT
ST_AsGeoJSON
(
ST_GeomFromText
(
'POINT(5.363 7.266)'
),
10
);
SELECT
ST_AsGeoJSON
(
ST_GeomFromText
(
"POINT(10 11)"
),
100
,
1
);
SELECT
ST_AsGeoJSON
(
ST_GeomFromText
(
"POINT(10 11)"
),
100
,
5
);
--
echo
#
--
echo
# End of 10.2 tests
--
echo
#
sql/item_geofunc.cc
View file @
1fad491c
...
...
@@ -259,6 +259,8 @@ String *Item_func_as_geojson::val_str_ascii(String *str)
DBUG_ASSERT
(
fixed
==
1
);
String
arg_val
;
String
*
swkb
=
args
[
0
]
->
val_str
(
&
arg_val
);
uint
max_dec
=
FLOATING_POINT_DECIMALS
;
longlong
options
=
0
;
Geometry_buffer
buffer
;
Geometry
*
geom
=
NULL
;
const
char
*
dummy
;
...
...
@@ -268,12 +270,41 @@ String *Item_func_as_geojson::val_str_ascii(String *str)
!
(
geom
=
Geometry
::
construct
(
&
buffer
,
swkb
->
ptr
(),
swkb
->
length
())))))
return
0
;
if
(
arg_count
>
1
)
{
max_dec
=
(
uint
)
args
[
1
]
->
val_int
();
if
(
args
[
1
]
->
null_value
)
max_dec
=
FLOATING_POINT_DECIMALS
;
if
(
arg_count
>
2
)
{
options
=
args
[
2
]
->
val_int
();
if
(
args
[
2
]
->
null_value
)
options
=
0
;
}
}
str
->
length
(
0
);
str
->
set_charset
(
&
my_charset_latin1
);
if
((
null_value
=
geom
->
as_json
(
str
,
FLOATING_POINT_DECIMALS
,
&
dummy
)))
if
(
str
->
reserve
(
1
,
512
))
return
0
;
str
->
qs_append
(
'{'
);
if
(
options
&
1
)
{
if
(
geom
->
bbox_as_json
(
str
)
||
str
->
append
(
", "
,
2
))
goto
error
;
}
if
((
geom
->
as_json
(
str
,
max_dec
,
&
dummy
)
||
str
->
append
(
"}"
,
1
)))
goto
error
;
return
str
;
error:
null_value
=
1
;
return
0
;
}
...
...
sql/spatial.cc
View file @
1fad491c
...
...
@@ -21,6 +21,10 @@
#include "gstream.h" // Gis_read_stream
#include "sql_string.h" // String
/* This is from item_func.h. Didn't want to #include the whole file. */
double
my_double_round
(
double
value
,
longlong
dec
,
bool
dec_unsigned
,
bool
truncate
);
#ifdef HAVE_SPATIAL
/*
...
...
@@ -250,6 +254,8 @@ static const uchar feature_type[]= "feature";
static
const
int
feature_type_len
=
7
;
static
const
uchar
feature_coll_type
[]
=
"featurecollection"
;
static
const
int
feature_coll_type_len
=
17
;
static
const
uchar
bbox_keyname
[]
=
"bbox"
;
static
const
int
bbox_keyname_len
=
4
;
int
Geometry
::
as_json
(
String
*
wkt
,
uint
max_dec_digits
,
const
char
**
end
)
...
...
@@ -258,7 +264,7 @@ int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
if
(
wkt
->
reserve
(
4
+
type_keyname_len
+
2
+
len
+
2
+
2
+
coord_keyname_len
+
4
,
512
))
return
1
;
wkt
->
qs_append
(
"
{
\"
"
,
2
);
wkt
->
qs_append
(
"
\"
"
,
1
);
wkt
->
qs_append
((
const
char
*
)
type_keyname
,
type_keyname_len
);
wkt
->
qs_append
(
"
\"
:
\"
"
,
4
);
wkt
->
qs_append
(
get_class_info
()
->
m_geojson_name
.
str
,
len
);
...
...
@@ -269,10 +275,35 @@ int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
wkt
->
qs_append
((
const
char
*
)
coord_keyname
,
coord_keyname_len
);
wkt
->
qs_append
(
"
\"
: "
,
3
);
if
(
get_data_as_json
(
wkt
,
max_dec_digits
,
end
)
||
wkt
->
reserve
(
1
))
if
(
get_data_as_json
(
wkt
,
max_dec_digits
,
end
))
return
1
;
wkt
->
qs_append
(
'}'
);
return
0
;
}
int
Geometry
::
bbox_as_json
(
String
*
wkt
)
{
MBR
mbr
;
const
char
*
end
;
if
(
wkt
->
reserve
(
5
+
bbox_keyname_len
+
(
FLOATING_POINT_DECIMALS
+
2
)
*
4
,
512
))
return
1
;
wkt
->
qs_append
(
"
\"
"
,
1
);
wkt
->
qs_append
((
const
char
*
)
bbox_keyname
,
bbox_keyname_len
);
wkt
->
qs_append
(
"
\"
: ["
,
4
);
if
(
get_mbr
(
&
mbr
,
&
end
))
return
1
;
wkt
->
qs_append
(
mbr
.
xmin
);
wkt
->
qs_append
(
", "
,
2
);
wkt
->
qs_append
(
mbr
.
ymin
);
wkt
->
qs_append
(
", "
,
2
);
wkt
->
qs_append
(
mbr
.
xmax
);
wkt
->
qs_append
(
", "
,
2
);
wkt
->
qs_append
(
mbr
.
ymax
);
wkt
->
qs_append
(
"]"
,
1
);
return
0
;
}
...
...
@@ -670,6 +701,11 @@ static void append_json_point(String *txt, uint max_dec, const char *data)
{
double
x
,
y
;
get_point
(
&
x
,
&
y
,
data
);
if
(
max_dec
<
FLOATING_POINT_DECIMALS
)
{
x
=
my_double_round
(
x
,
max_dec
,
FALSE
,
FALSE
);
y
=
my_double_round
(
y
,
max_dec
,
FALSE
,
FALSE
);
}
txt
->
qs_append
(
'['
);
txt
->
qs_append
(
x
);
txt
->
qs_append
(
", "
,
2
);
...
...
@@ -3106,12 +3142,14 @@ bool Gis_geometry_collection::get_data_as_json(String *txt, uint max_dec_digits,
if
(
!
(
geom
=
create_by_typeid
(
&
buffer
,
wkb_type
)))
return
1
;
geom
->
set_data_ptr
(
data
,
(
uint
)
(
m_data_end
-
data
));
if
(
geom
->
as_json
(
txt
,
max_dec_digits
,
&
data
)
||
txt
->
append
(
STRING_WITH_LEN
(
", "
),
512
))
if
(
txt
->
append
(
"{"
,
1
)
||
geom
->
as_json
(
txt
,
max_dec_digits
,
&
data
)
||
txt
->
append
(
STRING_WITH_LEN
(
"}, "
),
512
))
return
1
;
}
txt
->
length
(
txt
->
length
()
-
2
);
txt
->
qs_append
(
']'
);
if
(
txt
->
append
(
"]"
,
1
))
return
1
;
*
end
=
data
;
return
0
;
...
...
sql/spatial.h
View file @
1fad491c
...
...
@@ -323,6 +323,7 @@ class Geometry
String
*
res
,
Gcalc_result_receiver
&
rr
);
int
as_wkt
(
String
*
wkt
,
const
char
**
end
);
int
as_json
(
String
*
wkt
,
uint
max_dec_digits
,
const
char
**
end
);
int
bbox_as_json
(
String
*
wkt
);
inline
void
set_data_ptr
(
const
char
*
data
,
uint32
data_len
)
{
...
...
storage/innobase/ibuf/ibuf0ibuf.cc
View file @
1fad491c
...
...
@@ -534,7 +534,6 @@ ibuf_init_at_db_start(void)
fseg_n_reserved_pages
(
header_page
+
IBUF_HEADER
+
IBUF_TREE_SEG_HEADER
,
&
n_used
,
&
mtr
);
ibuf_enter
(
&
mtr
);
ut_ad
(
n_used
>=
2
);
...
...
@@ -556,7 +555,7 @@ ibuf_init_at_db_start(void)
mutex_exit
(
&
ibuf_mutex
);
ibuf
->
empty
=
page_is_empty
(
root
);
ibuf_mtr_commit
(
&
mtr
);
mtr
.
commit
(
);
ibuf
->
index
=
dict_mem_index_create
(
"innodb_change_buffer"
,
"CLUST_IND"
,
...
...
storage/innobase/log/log0log.cc
View file @
1fad491c
...
...
@@ -359,7 +359,6 @@ log_reserve_and_open(
loop:
ut_ad
(
log_mutex_own
());
ut_ad
(
!
recv_no_log_write
);
if
(
log_sys
->
is_extending
)
{
log_mutex_exit
();
...
...
@@ -416,7 +415,6 @@ log_write_low(
ut_ad
(
log_mutex_own
());
part_loop:
ut_ad
(
!
recv_no_log_write
);
/* Calculate a part length */
data_len
=
(
log
->
buf_free
%
OS_FILE_LOG_BLOCK_SIZE
)
+
str_len
;
...
...
@@ -2291,6 +2289,7 @@ log_pad_current_log_block(void)
ulint
i
;
lsn_t
lsn
;
ut_ad
(
!
recv_no_log_write
);
/* We retrieve lsn only because otherwise gcc crashed on HP-UX */
lsn
=
log_reserve_and_open
(
OS_FILE_LOG_BLOCK_SIZE
);
...
...
storage/innobase/mtr/mtr0mtr.cc
View file @
1fad491c
...
...
@@ -478,6 +478,7 @@ mtr_write_log(
const
ulint
len
=
log
->
size
();
mtr_write_log_t
write_log
;
ut_ad
(
!
recv_no_log_write
);
DBUG_PRINT
(
"ib_log"
,
(
ULINTPF
" extra bytes written at "
LSN_PF
,
len
,
log_sys
->
lsn
));
...
...
@@ -799,6 +800,8 @@ mtr_t::release_page(const void* ptr, mtr_memo_type_t type)
ulint
mtr_t
::
Command
::
prepare_write
()
{
ut_ad
(
!
recv_no_log_write
);
switch
(
m_impl
->
m_log_mode
)
{
case
MTR_LOG_SHORT_INSERTS
:
ut_ad
(
0
);
...
...
strings/json_lib.c
View file @
1fad491c
...
...
@@ -1756,7 +1756,7 @@ int json_path_parts_compare(
goto
step_fits
;
goto
step_failed
;
}
if
(
a
->
n_item
==
0
)
if
(
(
a
->
type
&
JSON_PATH_WILD
)
==
0
&&
a
->
n_item
==
0
)
goto
step_fits_autowrap
;
goto
step_failed
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment