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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7835ff50
Commit
7835ff50
authored
Apr 03, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AsWKB() function has been added.
parent
1e8cc909
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
2 deletions
+44
-2
mysql-test/r/gis.result
mysql-test/r/gis.result
+4
-1
mysql-test/t/gis.test
mysql-test/t/gis.test
+3
-1
sql/item_create.cc
sql/item_create.cc
+5
-0
sql/item_create.h
sql/item_create.h
+1
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+21
-0
sql/item_strfunc.h
sql/item_strfunc.h
+9
-0
sql/lex.h
sql/lex.h
+1
-0
No files found.
mysql-test/r/gis.result
View file @
7835ff50
...
...
@@ -43,7 +43,7 @@ INSERT INTO pt VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFrom
Text('POINT(10 20)'
));
(104, PointFrom
WKB(AsWKB(PointFromText('POINT(10 20)'))
));
INSERT INTO ls VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
...
...
@@ -388,3 +388,6 @@ gc geometrycollection binary YES NULL
gm geometry binary YES NULL
fid int(11) binary 0
DROP TABLE g1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
POINT(1 4)
mysql-test/t/gis.test
View file @
7835ff50
...
...
@@ -29,7 +29,7 @@ INSERT INTO pt VALUES
(
101
,
PointFromText
(
'POINT(10 10)'
)),
(
102
,
PointFromText
(
'POINT(20 10)'
)),
(
103
,
PointFromText
(
'POINT(20 20)'
)),
(
104
,
PointFrom
Text
(
'POINT(10 20)'
));
(
104
,
PointFrom
WKB
(
AsWKB
(
PointFromText
(
'POINT(10 20)'
))
));
INSERT
INTO
ls
VALUES
(
105
,
LineFromText
(
'LINESTRING(0 0,0 10,10 0)'
)),
...
...
@@ -140,3 +140,5 @@ SHOW FIELDS FROM g1;
ALTER
TABLE
g1
ADD
fid
INT
NOT
NULL
;
SHOW
FIELDS
FROM
g1
;
DROP
TABLE
g1
;
SELECT
AsText
(
GeometryFromWKB
(
AsWKB
(
GeometryFromText
(
'POINT(1 4)'
))));
sql/item_create.cc
View file @
7835ff50
...
...
@@ -491,6 +491,11 @@ Item *create_func_as_text(Item *a)
return
new
Item_func_as_text
(
a
);
}
Item
*
create_func_as_wkb
(
Item
*
a
)
{
return
new
Item_func_as_wkb
(
a
);
}
Item
*
create_func_srid
(
Item
*
a
)
{
return
new
Item_func_srid
(
a
);
...
...
sql/item_create.h
View file @
7835ff50
...
...
@@ -105,6 +105,7 @@ Item *create_func_quote(Item* a);
Item
*
create_func_geometry_from_text
(
Item
*
a
);
Item
*
create_func_as_text
(
Item
*
a
);
Item
*
create_func_as_wkb
(
Item
*
a
);
Item
*
create_func_srid
(
Item
*
a
);
Item
*
create_func_startpoint
(
Item
*
a
);
Item
*
create_func_endpoint
(
Item
*
a
);
...
...
sql/item_strfunc.cc
View file @
7835ff50
...
...
@@ -2585,6 +2585,27 @@ void Item_func_as_text::fix_length_and_dec()
max_length
=
MAX_BLOB_WIDTH
;
}
String
*
Item_func_as_wkb
::
val_str
(
String
*
str
)
{
String
arg_val
;
String
*
swkb
=
args
[
0
]
->
val_str
(
&
arg_val
);
Geometry
geom
;
if
((
null_value
=
(
args
[
0
]
->
null_value
||
geom
.
create_from_wkb
(
swkb
->
ptr
()
+
SRID_SIZE
,
swkb
->
length
()
-
SRID_SIZE
))))
return
0
;
str
->
copy
(
swkb
->
ptr
()
+
SRID_SIZE
,
swkb
->
length
()
-
SRID_SIZE
,
&
my_charset_bin
);
return
str
;
}
void
Item_func_as_wkb
::
fix_length_and_dec
()
{
max_length
=
MAX_BLOB_WIDTH
;
}
String
*
Item_func_geometry_type
::
val_str
(
String
*
str
)
{
String
*
swkb
=
args
[
0
]
->
val_str
(
str
);
...
...
sql/item_strfunc.h
View file @
7835ff50
...
...
@@ -665,6 +665,15 @@ public:
void
fix_length_and_dec
();
};
class
Item_func_as_wkb
:
public
Item_str_func
{
public:
Item_func_as_wkb
(
Item
*
a
)
:
Item_str_func
(
a
)
{}
const
char
*
func_name
()
const
{
return
"aswkb"
;
}
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
};
class
Item_func_geometry_type
:
public
Item_str_func
{
public:
...
...
sql/lex.h
View file @
7835ff50
...
...
@@ -429,6 +429,7 @@ static SYMBOL sql_functions[] = {
{
"AREA"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_area
)},
{
"ASIN"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_asin
)},
{
"ASTEXT"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_as_text
)},
{
"ASWKB"
,
SYM
(
FUNC_ARG1
),
0
,
CREATE_FUNC
(
create_func_as_wkb
)},
{
"ATAN"
,
SYM
(
ATAN
),
0
,
0
},
{
"ATAN2"
,
SYM
(
ATAN
),
0
,
0
},
{
"BENCHMARK"
,
SYM
(
BENCHMARK_SYM
),
0
,
0
},
...
...
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