Bug #388 Spatial extension: SELECT AsBinary(g) does not function
Submitted: 7 May 2003 8:18 Modified: 21 May 2003 0:52
Reporter: Stepan Rybar Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 alpha OS:Windows (MS Windows XP Pro)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[7 May 2003 8:18] Stepan Rybar
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? 


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`)

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
[21 May 2003 0:52] Ramil Kalimullin
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 

Thank you for the bug report.
I've added AsBinary alias for AsWKB funtion.