Cannot insert GeomFromText('POINT(..)') in MySQL

廉价感情. 提交于 2019-12-13 14:30:44

问题


I've created a database where one of the tables stores the geolocation of some points. I'm trying to fill that table, which a priori seems pretty easy with GeomFromText('POINT(39.48280 -0.34804)'), but it doesn't work. All the other columns, like id, name... do get their values, but the location column remains empty.

So then I try to update the row I've just added with:

UPDATE `pfc_db`.`poi`
SET
`location` = GeomFromText('POINT(39.48280 -0.34804)')
WHERE id = 'poi00001';

And MySQLWorkbench shows its output:

0 row(s) affected
Rows matched: 1  Changed: 0  Warnings: 0

Why does it find the row it has to update but doesn't do it? If I try to update another column it works perfect, but not with the location.

I've been googling for a solution, I've found posts like MySQL INSERT/UPDATE on POINT column and I've tried the proposed solutions but still nothing.

So, anyone knows what I'm doing wrong?

Thanks for reading.


回答1:


I don't know why but the MySQLWorkbench GUI didn't display the Point variables, at least in my computer.

Then I tried to query the DB from a php script and it printed the Points perfectly, so the DB actually stored them. It was just a GUI display problem. Should I report it as a bug to MySQL?



来源:https://stackoverflow.com/questions/6144053/cannot-insert-geomfromtextpoint-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!