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
08690ef2
Commit
08690ef2
authored
15 years ago
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
e4d4226e
8dafd2b9
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
564 additions
and
526 deletions
+564
-526
mysql-test/r/gis-rtree.result
mysql-test/r/gis-rtree.result
+334
-334
mysql-test/r/gis.result
mysql-test/r/gis.result
+6
-6
mysql-test/t/gis-rtree.test
mysql-test/t/gis-rtree.test
+36
-36
mysql-test/t/gis.test
mysql-test/t/gis.test
+6
-6
sql/item_geofunc.cc
sql/item_geofunc.cc
+19
-8
sql/rpl_filter.cc
sql/rpl_filter.cc
+1
-2
sql/sp_head.cc
sql/sp_head.cc
+14
-13
sql/sp_head.h
sql/sp_head.h
+4
-4
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+11
-12
sql/sp_pcontext.h
sql/sp_pcontext.h
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+31
-19
sql/sql_yacc.yy
sql/sql_yacc.yy
+87
-82
storage/myisam/mi_delete.c
storage/myisam/mi_delete.c
+5
-1
storage/myisam/mi_write.c
storage/myisam/mi_write.c
+8
-1
No files found.
mysql-test/r/gis-rtree.result
View file @
08690ef2
This diff is collapsed.
Click to expand it.
mysql-test/r/gis.result
View file @
08690ef2
...
...
@@ -47,26 +47,26 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(
LineString(Point(10, 10), Point(40, 10
))));
(107, LineStringFromWKB(
AsWKB(LineString(Point(10, 10), Point(40, 10)
))));
INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(
Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0
)))));
(110, PolyFromWKB(
AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)
)))));
INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(
MultiPoint(Point(3, 6), Point(4, 10
))));
(113, MPointFromWKB(
AsWKB(MultiPoint(Point(3, 6), Point(4, 10)
))));
INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(
MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7
)))));
(116, MLineFromWKB(
AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)
)))));
INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(
MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3
))))));
(119, MPolyFromWKB(
AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)
))))));
INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(
GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9
)))));
(121, GeometryFromWKB(
AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)
)))));
INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon;
...
...
This diff is collapsed.
Click to expand it.
mysql-test/t/gis-rtree.test
View file @
08690ef2
...
...
@@ -41,7 +41,7 @@ while ($1)
let
$
2
=
10
;
while
(
$
2
)
{
eval
INSERT
INTO
t2
(
g
)
VALUES
(
GeometryFromWKB
(
LineString
(
Point
(
$
1
*
10
-
9
,
$
2
*
10
-
9
),
Point
(
$
1
*
10
,
$
2
*
10
)
)));
eval
INSERT
INTO
t2
(
g
)
VALUES
(
LineString
(
Point
(
$
1
*
10
-
9
,
$
2
*
10
-
9
),
Point
(
$
1
*
10
,
$
2
*
10
)));
dec
$
2
;
}
dec
$
1
;
...
...
@@ -61,7 +61,7 @@ while ($1)
let
$
2
=
10
;
while
(
$
2
)
{
eval
DELETE
FROM
t2
WHERE
Within
(
g
,
Envelope
(
GeometryFromWKB
(
LineString
(
Point
(
$
1
*
10
-
9
,
$
2
*
10
-
9
),
Point
(
$
1
*
10
,
$
2
*
10
)
))));
eval
DELETE
FROM
t2
WHERE
Within
(
g
,
Envelope
(
GeometryFromWKB
(
Point
(
$
1
*
10
-
9
,
$
2
*
10
-
9
),
Point
(
$
1
*
10
,
$
2
*
10
))));
SELECT
count
(
*
)
FROM
t2
;
dec
$
2
;
}
...
...
@@ -235,11 +235,11 @@ DROP TABLE t1;
# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
#
CREATE
TABLE
t1
(
foo
GEOMETRY
NOT
NULL
,
SPATIAL
INDEX
(
foo
)
);
INSERT
INTO
t1
(
foo
)
VALUES
(
P
ointFromWKB
(
POINT
(
1
,
1
)
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
ointFromWKB
(
POINT
(
1
,
0
)
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
ointFromWKB
(
POINT
(
0
,
1
)
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
ointFromWKB
(
POINT
(
0
,
0
)
));
SELECT
1
FROM
t1
WHERE
foo
!=
P
ointFromWKB
(
POINT
(
0
,
0
)
);
INSERT
INTO
t1
(
foo
)
VALUES
(
P
OINT
(
1
,
1
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
OINT
(
1
,
0
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
OINT
(
0
,
1
));
INSERT
INTO
t1
(
foo
)
VALUES
(
P
OINT
(
0
,
0
));
SELECT
1
FROM
t1
WHERE
foo
!=
P
OINT
(
0
,
0
);
DROP
TABLE
t1
;
#
...
...
@@ -802,35 +802,35 @@ DROP TABLE t1;
#
create
table
t1
(
a
geometry
not
null
,
spatial
index
(
a
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.1517219314031e+164
,
131072
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
9.1248812352444e+192
,
2.9740338169556e+284
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.7783097267365e-299
,
-
0
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.49166814624e-154
,
2.0880974297595e-53
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.0917382598702e+149
,
1.2024538023802e+111
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.0349165139404e+236
,
2.9993936277913e-241
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.5243548967072e-29
,
1.2024538023802e+111
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
0
,
6.9835074892995e-251
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.0880974297595e-53
,
3.1050361846014e+231
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.8728483499323e-188
,
2.4600631144627e+260
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
3.0517578125e-05
,
2.0349165139404e+236
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.1517219314031e+164
,
1.1818212630766e-125
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.481040258324e-265
,
5.7766220027675e-275
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.0880974297595e-53
,
2.5243548967072e-29
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
5.7766220027675e-275
,
9.9464647281957e+86
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.2181357552967e+130
,
3.7857669957337e-270
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.5767114681874e-246
,
3.6893488147419e+19
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.5767114681874e-246
,
3.7537584144024e+255
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
3.7857669957337e-270
,
1.8033161362863e-130
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
0
,
5.8774717541114e-39
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.1517219314031e+164
,
2.2761049594727e-159
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
6.243497100632e+144
,
3.7857669957337e-270
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
3.7857669957337e-270
,
2.6355494858076e-82
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.0349165139404e+236
,
3.8518598887745e-34
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.6566128730774e-10
,
2.0880974297595e-53
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
2.0880974297595e-53
,
1.8827498946116e-183
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.8033161362863e-130
,
9.1248812352444e+192
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
4.7783097267365e-299
,
2.2761049594727e-159
)
));
insert
into
t1
values
(
P
ointFromWKB
(
POINT
(
1.94906280228e+289
,
1.2338789709327e-178
)
));
insert
into
t1
values
(
P
OINT
(
1.1517219314031e+164
,
131072
));
insert
into
t1
values
(
P
OINT
(
9.1248812352444e+192
,
2.9740338169556e+284
));
insert
into
t1
values
(
P
OINT
(
4.7783097267365e-299
,
-
0
));
insert
into
t1
values
(
P
OINT
(
1.49166814624e-154
,
2.0880974297595e-53
));
insert
into
t1
values
(
P
OINT
(
4.0917382598702e+149
,
1.2024538023802e+111
));
insert
into
t1
values
(
P
OINT
(
2.0349165139404e+236
,
2.9993936277913e-241
));
insert
into
t1
values
(
P
OINT
(
2.5243548967072e-29
,
1.2024538023802e+111
));
insert
into
t1
values
(
P
OINT
(
0
,
6.9835074892995e-251
));
insert
into
t1
values
(
P
OINT
(
2.0880974297595e-53
,
3.1050361846014e+231
));
insert
into
t1
values
(
P
OINT
(
2.8728483499323e-188
,
2.4600631144627e+260
));
insert
into
t1
values
(
P
OINT
(
3.0517578125e-05
,
2.0349165139404e+236
));
insert
into
t1
values
(
P
OINT
(
1.1517219314031e+164
,
1.1818212630766e-125
));
insert
into
t1
values
(
P
OINT
(
2.481040258324e-265
,
5.7766220027675e-275
));
insert
into
t1
values
(
P
OINT
(
2.0880974297595e-53
,
2.5243548967072e-29
));
insert
into
t1
values
(
P
OINT
(
5.7766220027675e-275
,
9.9464647281957e+86
));
insert
into
t1
values
(
P
OINT
(
2.2181357552967e+130
,
3.7857669957337e-270
));
insert
into
t1
values
(
P
OINT
(
4.5767114681874e-246
,
3.6893488147419e+19
));
insert
into
t1
values
(
P
OINT
(
4.5767114681874e-246
,
3.7537584144024e+255
));
insert
into
t1
values
(
P
OINT
(
3.7857669957337e-270
,
1.8033161362863e-130
));
insert
into
t1
values
(
P
OINT
(
0
,
5.8774717541114e-39
));
insert
into
t1
values
(
P
OINT
(
1.1517219314031e+164
,
2.2761049594727e-159
));
insert
into
t1
values
(
P
OINT
(
6.243497100632e+144
,
3.7857669957337e-270
));
insert
into
t1
values
(
P
OINT
(
3.7857669957337e-270
,
2.6355494858076e-82
));
insert
into
t1
values
(
P
OINT
(
2.0349165139404e+236
,
3.8518598887745e-34
));
insert
into
t1
values
(
P
OINT
(
4.6566128730774e-10
,
2.0880974297595e-53
));
insert
into
t1
values
(
P
OINT
(
2.0880974297595e-53
,
1.8827498946116e-183
));
insert
into
t1
values
(
P
OINT
(
1.8033161362863e-130
,
9.1248812352444e+192
));
insert
into
t1
values
(
P
OINT
(
4.7783097267365e-299
,
2.2761049594727e-159
));
insert
into
t1
values
(
P
OINT
(
1.94906280228e+289
,
1.2338789709327e-178
));
drop
table
t1
;
# End of 4.1 tests
...
...
This diff is collapsed.
Click to expand it.
mysql-test/t/gis.test
View file @
08690ef2
...
...
@@ -37,32 +37,32 @@ INSERT INTO gis_point VALUES
INSERT
INTO
gis_line
VALUES
(
105
,
LineFromText
(
'LINESTRING(0 0,0 10,10 0)'
)),
(
106
,
LineStringFromText
(
'LINESTRING(10 10,20 10,20 20,10 20,10 10)'
)),
(
107
,
LineStringFromWKB
(
LineString
(
Point
(
10
,
10
),
Point
(
40
,
10
))));
(
107
,
LineStringFromWKB
(
AsWKB
(
LineString
(
Point
(
10
,
10
),
Point
(
40
,
10
)
))));
INSERT
INTO
gis_polygon
VALUES
(
108
,
PolygonFromText
(
'POLYGON((10 10,20 10,20 20,10 20,10 10))'
)),
(
109
,
PolyFromText
(
'POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'
)),
(
110
,
PolyFromWKB
(
Polygon
(
LineString
(
Point
(
0
,
0
),
Point
(
30
,
0
),
Point
(
30
,
30
),
Point
(
0
,
0
)))));
(
110
,
PolyFromWKB
(
AsWKB
(
Polygon
(
LineString
(
Point
(
0
,
0
),
Point
(
30
,
0
),
Point
(
30
,
30
),
Point
(
0
,
0
)
)))));
INSERT
INTO
gis_multi_point
VALUES
(
111
,
MultiPointFromText
(
'MULTIPOINT(0 0,10 10,10 20,20 20)'
)),
(
112
,
MPointFromText
(
'MULTIPOINT(1 1,11 11,11 21,21 21)'
)),
(
113
,
MPointFromWKB
(
MultiPoint
(
Point
(
3
,
6
),
Point
(
4
,
10
))));
(
113
,
MPointFromWKB
(
AsWKB
(
MultiPoint
(
Point
(
3
,
6
),
Point
(
4
,
10
)
))));
INSERT
INTO
gis_multi_line
VALUES
(
114
,
MultiLineStringFromText
(
'MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))'
)),
(
115
,
MLineFromText
(
'MULTILINESTRING((10 48,10 21,10 0))'
)),
(
116
,
MLineFromWKB
(
MultiLineString
(
LineString
(
Point
(
1
,
2
),
Point
(
3
,
5
)),
LineString
(
Point
(
2
,
5
),
Point
(
5
,
8
),
Point
(
21
,
7
)))));
(
116
,
MLineFromWKB
(
AsWKB
(
MultiLineString
(
LineString
(
Point
(
1
,
2
),
Point
(
3
,
5
)),
LineString
(
Point
(
2
,
5
),
Point
(
5
,
8
),
Point
(
21
,
7
)
)))));
INSERT
INTO
gis_multi_polygon
VALUES
(
117
,
MultiPolygonFromText
(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
)),
(
118
,
MPolyFromText
(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'
)),
(
119
,
MPolyFromWKB
(
MultiPolygon
(
Polygon
(
LineString
(
Point
(
0
,
3
),
Point
(
3
,
3
),
Point
(
3
,
0
),
Point
(
0
,
3
))))));
(
119
,
MPolyFromWKB
(
AsWKB
(
MultiPolygon
(
Polygon
(
LineString
(
Point
(
0
,
3
),
Point
(
3
,
3
),
Point
(
3
,
0
),
Point
(
0
,
3
)
))))));
INSERT
INTO
gis_geometrycollection
VALUES
(
120
,
GeomCollFromText
(
'GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'
)),
(
121
,
GeometryFromWKB
(
GeometryCollection
(
Point
(
44
,
6
),
LineString
(
Point
(
3
,
6
),
Point
(
7
,
9
)))));
(
121
,
GeometryFromWKB
(
AsWKB
(
GeometryCollection
(
Point
(
44
,
6
),
LineString
(
Point
(
3
,
6
),
Point
(
7
,
9
)
)))));
INSERT
into
gis_geometry
SELECT
*
FROM
gis_point
;
INSERT
into
gis_geometry
SELECT
*
FROM
gis_line
;
...
...
This diff is collapsed.
Click to expand it.
sql/item_geofunc.cc
View file @
08690ef2
...
...
@@ -78,10 +78,17 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
{
DBUG_ASSERT
(
fixed
==
1
);
String
arg_val
;
String
*
wkb
=
args
[
0
]
->
val_str
(
&
arg_val
)
;
String
*
wkb
;
Geometry_buffer
buffer
;
uint32
srid
=
0
;
if
(
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_GEOMETRY
)
{
return
args
[
0
]
->
val_str
(
str
);
}
wkb
=
args
[
0
]
->
val_str
(
&
arg_val
);
if
((
arg_count
==
2
)
&&
!
args
[
1
]
->
null_value
)
srid
=
(
uint32
)
args
[
1
]
->
val_int
();
...
...
@@ -91,8 +98,8 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
str
->
length
(
0
);
str
->
q_append
(
srid
);
if
((
null_value
=
(
args
[
0
]
->
null_value
||
!
Geometry
::
create_from_wkb
(
&
buffer
,
wkb
->
ptr
(),
wkb
->
length
(),
str
))))
(
args
[
0
]
->
null_value
||
!
Geometry
::
create_from_wkb
(
&
buffer
,
wkb
->
ptr
(),
wkb
->
length
(),
str
))))
return
0
;
return
str
;
}
...
...
@@ -345,14 +352,16 @@ String *Item_func_point::val_str(String *str)
DBUG_ASSERT
(
fixed
==
1
);
double
x
=
args
[
0
]
->
val_real
();
double
y
=
args
[
1
]
->
val_real
();
uint32
srid
=
0
;
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
||
str
->
realloc
(
1
+
4
+
SIZEOF_STORED_DOUBLE
*
2
))))
str
->
realloc
(
4
/*SRID*/
+
1
+
4
+
SIZEOF_STORED_DOUBLE
*
2
))))
return
0
;
str
->
set_charset
(
&
my_charset_bin
);
str
->
length
(
0
);
str
->
q_append
(
srid
);
str
->
q_append
((
char
)
Geometry
::
wkb_ndr
);
str
->
q_append
((
uint32
)
Geometry
::
wkb_point
);
str
->
q_append
(
x
);
...
...
@@ -376,12 +385,14 @@ String *Item_func_spatial_collection::val_str(String *str)
DBUG_ASSERT
(
fixed
==
1
);
String
arg_value
;
uint
i
;
uint32
srid
=
0
;
str
->
set_charset
(
&
my_charset_bin
);
str
->
length
(
0
);
if
(
str
->
reserve
(
1
+
4
+
4
,
512
))
if
(
str
->
reserve
(
4
/*SRID*/
+
1
+
4
+
4
,
512
))
goto
err
;
str
->
q_append
(
srid
);
str
->
q_append
((
char
)
Geometry
::
wkb_ndr
);
str
->
q_append
((
uint32
)
coll_type
);
str
->
q_append
((
uint32
)
arg_count
);
...
...
@@ -399,13 +410,13 @@ String *Item_func_spatial_collection::val_str(String *str)
In the case of GeometryCollection we don't need any checkings
for item types, so just copy them into target collection
*/
if
(
str
->
append
(
res
->
ptr
()
,
len
,
(
uint32
)
512
))
if
(
str
->
append
(
res
->
ptr
()
+
4
/*SRID*/
,
len
-
4
/*SRID*/
,
(
uint32
)
512
))
goto
err
;
}
else
{
enum
Geometry
::
wkbType
wkb_type
;
const
char
*
data
=
res
->
ptr
()
+
1
;
const
char
*
data
=
res
->
ptr
()
+
4
/*SRID*/
+
1
;
/*
In the case of named collection we must check that items
...
...
@@ -414,7 +425,7 @@ String *Item_func_spatial_collection::val_str(String *str)
wkb_type
=
(
Geometry
::
wkbType
)
uint4korr
(
data
);
data
+=
4
;
len
-=
5
;
len
-=
5
+
4
/*SRID*/
;
if
(
wkb_type
!=
item_type
)
goto
err
;
...
...
This diff is collapsed.
Click to expand it.
sql/rpl_filter.cc
View file @
08690ef2
...
...
@@ -340,8 +340,7 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
e
->
tbl_name
=
e
->
db
+
(
dot
-
table_spec
)
+
1
;
e
->
key_len
=
len
;
memcpy
(
e
->
db
,
table_spec
,
len
);
insert_dynamic
(
a
,
(
uchar
*
)
&
e
);
return
0
;
return
insert_dynamic
(
a
,
(
uchar
*
)
&
e
);
}
...
...
This diff is collapsed.
Click to expand it.
sql/sp_head.cc
View file @
08690ef2
...
...
@@ -2132,17 +2132,16 @@ sp_head::restore_lex(THD *thd)
/**
Put the instruction on the backpatch list, associated with the label.
*/
void
int
sp_head
::
push_backpatch
(
sp_instr
*
i
,
sp_label_t
*
lab
)
{
bp_t
*
bp
=
(
bp_t
*
)
sql_alloc
(
sizeof
(
bp_t
));
if
(
bp
)
{
bp
->
lab
=
lab
;
bp
->
instr
=
i
;
(
void
)
m_backpatch
.
push_front
(
bp
);
}
if
(
!
bp
)
return
1
;
bp
->
lab
=
lab
;
bp
->
instr
=
i
;
return
m_backpatch
.
push_front
(
bp
);
}
/**
...
...
@@ -2217,7 +2216,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
}
void
int
sp_head
::
new_cont_backpatch
(
sp_instr_opt_meta
*
i
)
{
m_cont_level
+=
1
;
...
...
@@ -2225,15 +2224,17 @@ sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{
/* Use the cont. destination slot to store the level */
i
->
m_cont_dest
=
m_cont_level
;
(
void
)
m_cont_backpatch
.
push_front
(
i
);
if
(
m_cont_backpatch
.
push_front
(
i
))
return
1
;
}
return
0
;
}
void
int
sp_head
::
add_cont_backpatch
(
sp_instr_opt_meta
*
i
)
{
i
->
m_cont_dest
=
m_cont_level
;
(
void
)
m_cont_backpatch
.
push_front
(
i
);
return
m_cont_backpatch
.
push_front
(
i
);
}
void
...
...
@@ -2469,7 +2470,7 @@ sp_head::show_create_routine(THD *thd, int type)
@param instr Instruction
*/
void
sp_head
::
add_instr
(
sp_instr
*
instr
)
int
sp_head
::
add_instr
(
sp_instr
*
instr
)
{
instr
->
free_list
=
m_thd
->
free_list
;
m_thd
->
free_list
=
0
;
...
...
@@ -2480,7 +2481,7 @@ void sp_head::add_instr(sp_instr *instr)
entire stored procedure, as their life span is equal.
*/
instr
->
mem_root
=
&
main_mem_root
;
insert_dynamic
(
&
m_instr
,
(
uchar
*
)
&
instr
);
return
insert_dynamic
(
&
m_instr
,
(
uchar
*
)
&
instr
);
}
...
...
This diff is collapsed.
Click to expand it.
sql/sp_head.h
View file @
08690ef2
...
...
@@ -308,7 +308,7 @@ class sp_head :private Query_arena
bool
show_create_routine
(
THD
*
thd
,
int
type
);
void
int
add_instr
(
sp_instr
*
instr
);
inline
uint
...
...
@@ -344,7 +344,7 @@ class sp_head :private Query_arena
restore_lex
(
THD
*
thd
);
/// Put the instruction on the backpatch list, associated with the label.
void
int
push_backpatch
(
sp_instr
*
,
struct
sp_label
*
);
/// Update all instruction with this label in the backpatch list to
...
...
@@ -353,11 +353,11 @@ class sp_head :private Query_arena
backpatch
(
struct
sp_label
*
);
/// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void
int
new_cont_backpatch
(
sp_instr_opt_meta
*
i
);
/// Add an instruction to the current level
void
int
add_cont_backpatch
(
sp_instr_opt_meta
*
i
);
/// Backpatch (and pop) the current level to the current position.
...
...
This diff is collapsed.
Click to expand it.
sql/sp_pcontext.cc
View file @
08690ef2
...
...
@@ -265,8 +265,8 @@ sp_pcontext::push_variable(LEX_STRING *name, enum enum_field_types type,
p
->
mode
=
mode
;
p
->
offset
=
current_var_count
();
p
->
dflt
=
NULL
;
i
nsert_dynamic
(
&
m_vars
,
(
uchar
*
)
&
p
);
i
f
(
insert_dynamic
(
&
m_vars
,
(
uchar
*
)
&
p
))
return
NULL
;
return
p
;
}
...
...
@@ -310,18 +310,17 @@ sp_pcontext::find_label(char *name)
return
NULL
;
}
void
int
sp_pcontext
::
push_cond
(
LEX_STRING
*
name
,
sp_cond_type_t
*
val
)
{
sp_cond_t
*
p
=
(
sp_cond_t
*
)
sql_alloc
(
sizeof
(
sp_cond_t
));
if
(
p
)
{
p
->
name
.
str
=
name
->
str
;
p
->
name
.
length
=
name
->
length
;
p
->
val
=
val
;
insert_dynamic
(
&
m_conds
,
(
uchar
*
)
&
p
);
}
if
(
p
==
NULL
)
return
1
;
p
->
name
.
str
=
name
->
str
;
p
->
name
.
length
=
name
->
length
;
p
->
val
=
val
;
return
insert_dynamic
(
&
m_conds
,
(
uchar
*
)
&
p
);
}
/*
...
...
@@ -384,7 +383,7 @@ sp_pcontext::find_handler(sp_cond_type_t *cond)
return
FALSE
;
}
void
int
sp_pcontext
::
push_cursor
(
LEX_STRING
*
name
)
{
LEX_STRING
n
;
...
...
@@ -393,7 +392,7 @@ sp_pcontext::push_cursor(LEX_STRING *name)
m_max_cursor_index
+=
1
;
n
.
str
=
name
->
str
;
n
.
length
=
name
->
length
;
insert_dynamic
(
&
m_cursors
,
(
uchar
*
)
&
n
);
return
insert_dynamic
(
&
m_cursors
,
(
uchar
*
)
&
n
);
}
/*
...
...
This diff is collapsed.
Click to expand it.
sql/sp_pcontext.h
View file @
08690ef2
...
...
@@ -323,7 +323,7 @@ class sp_pcontext : public Sql_alloc
// Conditions
//
void
int
push_cond
(
LEX_STRING
*
name
,
sp_cond_type_t
*
val
);
inline
void
...
...
@@ -365,7 +365,7 @@ class sp_pcontext : public Sql_alloc
// Cursors
//
void
int
push_cursor
(
LEX_STRING
*
name
);
my_bool
...
...
This diff is collapsed.
Click to expand it.
sql/sql_select.cc
View file @
08690ef2
...
...
@@ -3476,14 +3476,6 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
}
}
/**
Add all keys with uses 'field' for some keypart.
If field->and_level != and_level then only mark key_part as const_part.
@todo
ft-keys in non-ft queries. SerG
*/
static
uint
max_part_bit
(
key_part_map
bits
)
...
...
@@ -3493,7 +3485,16 @@ max_part_bit(key_part_map bits)
return
found
;
}
static
void
/*
Add all keys with uses 'field' for some keypart
If field->and_level != and_level then only mark key_part as const_part
RETURN
0 - OK
1 - Out of memory.
*/
static
bool
add_key_part
(
DYNAMIC_ARRAY
*
keyuse_array
,
KEY_FIELD
*
key_field
)
{
Field
*
field
=
key_field
->
field
;
...
...
@@ -3523,24 +3524,26 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
keyuse
.
optimize
=
key_field
->
optimize
&
KEY_OPTIMIZE_REF_OR_NULL
;
keyuse
.
null_rejecting
=
key_field
->
null_rejecting
;
keyuse
.
cond_guard
=
key_field
->
cond_guard
;
VOID
(
insert_dynamic
(
keyuse_array
,(
uchar
*
)
&
keyuse
));
if
(
insert_dynamic
(
keyuse_array
,(
uchar
*
)
&
keyuse
))
return
TRUE
;
}
}
}
}
return
FALSE
;
}
#define FT_KEYPART (MAX_REF_PARTS+10)
static
void
static
bool
add_ft_keys
(
DYNAMIC_ARRAY
*
keyuse_array
,
JOIN_TAB
*
stat
,
COND
*
cond
,
table_map
usable_tables
)
{
Item_func_match
*
cond_func
=
NULL
;
if
(
!
cond
)
return
;
return
FALSE
;
if
(
cond
->
type
()
==
Item
::
FUNC_ITEM
)
{
...
...
@@ -3574,13 +3577,16 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
{
Item
*
item
;
while
((
item
=
li
++
))
add_ft_keys
(
keyuse_array
,
stat
,
item
,
usable_tables
);
{
if
(
add_ft_keys
(
keyuse_array
,
stat
,
item
,
usable_tables
))
return
TRUE
;
}
}
}
if
(
!
cond_func
||
cond_func
->
key
==
NO_SUCH_KEY
||
!
(
usable_tables
&
cond_func
->
table
->
map
))
return
;
return
FALSE
;
KEYUSE
keyuse
;
keyuse
.
table
=
cond_func
->
table
;
...
...
@@ -3590,7 +3596,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
keyuse
.
used_tables
=
cond_func
->
key_item
()
->
used_tables
();
keyuse
.
optimize
=
0
;
keyuse
.
keypart_map
=
0
;
VOID
(
insert_dynamic
(
keyuse_array
,(
uchar
*
)
&
keyuse
)
);
return
insert_dynamic
(
keyuse_array
,(
uchar
*
)
&
keyuse
);
}
...
...
@@ -3744,7 +3750,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
sargables
);
for
(;
field
!=
end
;
field
++
)
{
add_key_part
(
keyuse
,
field
);
if
(
add_key_part
(
keyuse
,
field
))
return
TRUE
;
/* Mark that we can optimize LEFT JOIN */
if
(
field
->
val
->
type
()
==
Item
::
NULL_ITEM
&&
!
field
->
field
->
real_maybe_null
())
...
...
@@ -3782,11 +3789,15 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* fill keyuse with found key parts */
for
(
;
field
!=
end
;
field
++
)
add_key_part
(
keyuse
,
field
);
{
if
(
add_key_part
(
keyuse
,
field
))
return
TRUE
;
}
if
(
select_lex
->
ftfunc_list
->
elements
)
{
add_ft_keys
(
keyuse
,
join_tab
,
cond
,
normal_tables
);
if
(
add_ft_keys
(
keyuse
,
join_tab
,
cond
,
normal_tables
))
return
TRUE
;
}
/*
...
...
@@ -3807,7 +3818,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
(
qsort_cmp
)
sort_keyuse
);
bzero
((
char
*
)
&
key_end
,
sizeof
(
key_end
));
/* Add for easy testing */
VOID
(
insert_dynamic
(
keyuse
,(
uchar
*
)
&
key_end
));
if
(
insert_dynamic
(
keyuse
,(
uchar
*
)
&
key_end
))
return
TRUE
;
use
=
save_pos
=
dynamic_element
(
keyuse
,
0
,
KEYUSE
*
);
prev
=
&
key_end
;
...
...
This diff is collapsed.
Click to expand it.
sql/sql_yacc.yy
View file @
08690ef2
This diff is collapsed.
Click to expand it.
storage/myisam/mi_delete.c
View file @
08690ef2
...
...
@@ -250,7 +250,11 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if
(
info
->
ft1_to_ft2
)
{
/* we're in ft1->ft2 conversion mode. Saving key data */
insert_dynamic
(
info
->
ft1_to_ft2
,
(
lastkey
+
off
));
if
(
insert_dynamic
(
info
->
ft1_to_ft2
,
(
lastkey
+
off
)))
{
DBUG_PRINT
(
"error"
,(
"Out of memory"
));
DBUG_RETURN
(
-
1
);
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
storage/myisam/mi_write.c
View file @
08690ef2
...
...
@@ -562,7 +562,14 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
we cannot easily dispatch an empty page here */
b
+=
blen
+
ft2len
+
2
;
for
(
a
=
anc_buff
+
a_length
;
b
<
a
;
b
+=
ft2len
+
2
)
insert_dynamic
(
info
->
ft1_to_ft2
,
b
);
{
if
(
insert_dynamic
(
info
->
ft1_to_ft2
,
b
))
{
mi_print_error
(
info
->
s
,
HA_ERR_OUT_OF_MEM
);
my_errno
=
HA_ERR_OUT_OF_MEM
;
DBUG_RETURN
(
-
1
);
}
}
/* fixing the page's length - it contains only one key now */
mi_putint
(
anc_buff
,
2
+
blen
+
ft2len
+
2
,
0
);
...
...
This diff is collapsed.
Click to expand it.
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