Description:
I have table with geometry attribute (see How to repeat). I have filled database with several records using WKT functions (see How to repeat). When I want to do select:
SELECT AsBinary(g) FROM roads
both in Java 1.4.1 or mysql command line client, both cases error:
ERROR 1064: You have an error in Your SQL syntax...
But this sql select command is taken from manual and should be OK. In manual is not written, that this function is not implemented now like space relations functions. If the problem is not in syntax, but in output of binary (even I read content into InputStream in Java), the error message is bug. Selecting AsText works fine (see How to repeat).
I think, it is bug, although I will definetly receive an answer from You, that it is bogus, that it is not implemented yet ;-) But, who knows? AsBinary is principal. I am going to write import filter from ESRI Shapefile to MySQL in Java 1.4.1.
Anyway, can I ask You if is any progress in spatial relations functions not based on MBR?
Stepan
How to repeat:
1) Create database.
# Host: localhost
# Database: test
# Table: 'roads'
#
CREATE TABLE `roads` (
`id` int(11) NOT NULL default '0',
`attribute` varchar(100) NOT NULL default '',
`g` geometry default NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM CHARSET=latin1;
2) Add data (here is select).
mysql> select id, attribute, AsText(g) from roads\g
+----+-----------+----------------------------+
| id | attribute | AsText(g) |
+----+-----------+----------------------------+
| 1 | 20 | LINESTRING(0 1,5 10,20 17) |
| 2 | 40 | LINESTRING(1 20,5 10) |
| 3 | 60 | LINESTRING(11 13,20 10) |
| 4 | 80 | LINESTRING(1 3,2 5) |
| 5 | 100 | LINESTRING(3 20,18 0) |
+----+-----------+----------------------------+
5 rows in set (0.00 sec)
3) Run select.
SELECT AsBinary(g) FROM roads