开发者

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

开发者 https://www.devze.com 2023-03-09 02:03 出处:网络
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)\')

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开发者_JS百科 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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消