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
e37d7a37
Commit
e37d7a37
authored
Jul 10, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-20006 Move geometry specific code in Field_blob::get_key_image() to Field_geom
parent
aca55321
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
36 deletions
+55
-36
sql/field.cc
sql/field.cc
+2
-33
sql/field.h
sql/field.h
+6
-1
sql/item.h
sql/item.h
+0
-2
sql/item_geofunc.h
sql/item_geofunc.h
+2
-0
sql/spatial.cc
sql/spatial.cc
+27
-0
sql/spatial.h
sql/spatial.h
+1
-0
sql/sql_type_geom.cc
sql/sql_type_geom.cc
+12
-0
sql/sql_type_geom.h
sql/sql_type_geom.h
+1
-0
storage/spider/spd_db_include.h
storage/spider/spd_db_include.h
+4
-0
No files found.
sql/field.cc
View file @
e37d7a37
...
...
@@ -8414,41 +8414,10 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
/* The following is used only when comparing a key */
uint
Field_blob
::
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type_arg
)
uint
Field_blob
::
get_key_image
_itRAW
(
uchar
*
buff
,
uint
length
)
{
size_t
blob_length
=
get_length
(
ptr
);
uchar
*
blob
;
#ifdef HAVE_SPATIAL
if
(
type_arg
==
itMBR
)
{
const
char
*
dummy
;
MBR
mbr
;
Geometry_buffer
buffer
;
Geometry
*
gobj
;
const
uint
image_length
=
SIZEOF_STORED_DOUBLE
*
4
;
if
(
blob_length
<
SRID_SIZE
)
{
bzero
(
buff
,
image_length
);
return
image_length
;
}
blob
=
get_ptr
();
gobj
=
Geometry
::
construct
(
&
buffer
,
(
char
*
)
blob
,
(
uint32
)
blob_length
);
if
(
!
gobj
||
gobj
->
get_mbr
(
&
mbr
,
&
dummy
))
bzero
(
buff
,
image_length
);
else
{
float8store
(
buff
,
mbr
.
xmin
);
float8store
(
buff
+
8
,
mbr
.
xmax
);
float8store
(
buff
+
16
,
mbr
.
ymin
);
float8store
(
buff
+
24
,
mbr
.
ymax
);
}
return
image_length
;
}
#endif
/*HAVE_SPATIAL*/
blob
=
get_ptr
();
uchar
*
blob
=
get_ptr
();
size_t
local_char_length
=
length
/
field_charset
->
mbmaxlen
;
local_char_length
=
my_charpos
(
field_charset
,
blob
,
blob
+
blob_length
,
local_char_length
);
...
...
sql/field.h
View file @
e37d7a37
...
...
@@ -3929,6 +3929,7 @@ class Field_blob :public Field_longstr {
static
void
do_copy_blob
(
Copy_field
*
copy
);
static
void
do_conv_blob
(
Copy_field
*
copy
);
uint
get_key_image_itRAW
(
uchar
*
buff
,
uint
length
);
public:
Field_blob
(
uchar
*
ptr_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
enum
utype
unireg_check_arg
,
const
LEX_CSTRING
*
field_name_arg
,
...
...
@@ -4104,7 +4105,11 @@ class Field_blob :public Field_longstr {
set_ptr_offset
(
0
,
length
,
data
);
}
int
copy_value
(
Field_blob
*
from
);
uint
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type
);
uint
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type
)
{
DBUG_ASSERT
(
type
==
itRAW
);
return
get_key_image_itRAW
(
buff
,
length
);
}
void
set_key_image
(
const
uchar
*
buff
,
uint
length
);
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
...
...
sql/item.h
View file @
e37d7a37
...
...
@@ -5785,8 +5785,6 @@ class Item_int_with_ref :public Item_int
};
#ifdef MYSQL_SERVER
#include "gstream.h"
#include "spatial.h"
#include "item_sum.h"
#include "item_func.h"
#include "item_row.h"
...
...
sql/item_geofunc.h
View file @
e37d7a37
...
...
@@ -28,6 +28,8 @@
#include "sql_type_geom.h"
#include "item.h"
#include "gstream.h"
#include "spatial.h"
#include "gcalc_slicescan.h"
#include "gcalc_tools.h"
...
...
sql/spatial.cc
View file @
e37d7a37
...
...
@@ -185,6 +185,33 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
}
uint
Geometry
::
get_key_image_itMBR
(
LEX_CSTRING
&
src
,
uchar
*
buff
,
uint
length
)
{
const
char
*
dummy
;
MBR
mbr
;
Geometry_buffer
buffer
;
Geometry
*
gobj
;
const
uint
image_length
=
SIZEOF_STORED_DOUBLE
*
4
;
if
(
src
.
length
<
SRID_SIZE
)
{
bzero
(
buff
,
image_length
);
return
image_length
;
}
gobj
=
Geometry
::
construct
(
&
buffer
,
(
char
*
)
src
.
str
,
(
uint32
)
src
.
length
);
if
(
!
gobj
||
gobj
->
get_mbr
(
&
mbr
,
&
dummy
))
bzero
(
buff
,
image_length
);
else
{
float8store
(
buff
,
mbr
.
xmin
);
float8store
(
buff
+
8
,
mbr
.
xmax
);
float8store
(
buff
+
16
,
mbr
.
ymin
);
float8store
(
buff
+
24
,
mbr
.
ymax
);
}
return
image_length
;
}
Geometry
*
Geometry
::
create_from_wkt
(
Geometry_buffer
*
buffer
,
Gis_read_stream
*
trs
,
String
*
wkt
,
bool
init_stream
)
...
...
sql/spatial.h
View file @
e37d7a37
...
...
@@ -322,6 +322,7 @@ class Geometry
bool
er_on_3D
,
String
*
res
);
static
Geometry
*
create_from_opresult
(
Geometry_buffer
*
g_buf
,
String
*
res
,
Gcalc_result_receiver
&
rr
);
static
uint
get_key_image_itMBR
(
LEX_CSTRING
&
src
,
uchar
*
buff
,
uint
length
);
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
);
...
...
sql/sql_type_geom.cc
View file @
e37d7a37
...
...
@@ -886,4 +886,16 @@ bool Field_geom::load_data_set_null(THD *thd)
}
uint
Field_geom
::
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type_arg
)
{
if
(
type_arg
==
itMBR
)
{
LEX_CSTRING
tmp
;
tmp
.
str
=
(
const
char
*
)
get_ptr
();
tmp
.
length
=
get_length
(
ptr
);
return
Geometry
::
get_key_image_itMBR
(
tmp
,
buff
,
length
);
}
return
Field_blob
::
get_key_image_itRAW
(
buff
,
length
);
}
#endif // HAVE_SPATIAL
sql/sql_type_geom.h
View file @
e37d7a37
...
...
@@ -412,6 +412,7 @@ class Field_geom :public Field_blob
represented differently, but we need to support it either way.
*/
uint32
key_length
()
const
{
return
packlength
;
}
uint
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type_arg
);
/**
Non-nullable GEOMETRY types cannot have defaults,
...
...
storage/spider/spd_db_include.h
View file @
e37d7a37
...
...
@@ -20,6 +20,10 @@
#define SPIDER_DBTON_SIZE 15
#ifndef SIZEOF_STORED_DOUBLE
#define SIZEOF_STORED_DOUBLE 8
#endif
#define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
...
...
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