为什么我不能插入MySQL?

TIM*_*MEX 5 mysql spatial geospatial mysql-error-1416

+---------+---------+------+-----+---------+----------------+
| Field   | Type    | Null | Key | Default | Extra          |
+---------+---------+------+-----+---------+----------------+
| id      | int(11) | NO   | PRI | NULL    | auto_increment |
| user_id | int(11) | NO   | UNI | NULL    |                |
| utm     | point   | NO   | MUL | NULL    |                |
+---------+---------+------+-----+---------+----------------+

insert into life(user_id, utm)  values(99,point(4,4));

ERROR 1416 (22003): Cannot get geometry object from data you send to the GEOMETRY field
Run Code Online (Sandbox Code Playgroud)

f3l*_*lix 5

你有没有尝试过:

insert into life(user_id, utm)  values(99,PointFromWKB(POINT(4,4)));
Run Code Online (Sandbox Code Playgroud)

  • 你的意思是MySQL吗?:d (4认同)
  • 根据http://bit.ly/9r97o5,这仅适用于5.1.35之前的MySQL版本.从5.1.35开始,您可以直接从Point()插入返回值. (3认同)