我的问题如下,建立一个polygon时全部用数字,没有问题,但使用一个变量就不行,不明白是什么原因?哪位知道麻烦告诉一声这是正常的
mysql> SET @polytemp = 'Polygon((0 0,0 3,3 0,0 0))';
Query OK, 0 rows affected (0.00 sec)mysql> select AsText(GeomFromText(@polytemp)) ;
+---------------------------------+
| AsText(GeomFromText(@polytemp)) |
+---------------------------------+
| POLYGON((0 0,0 3,3 0,0 0))      |
+---------------------------------+
1 row in set (0.00 sec)这是异常的
mysql> set @x=5;
Query OK, 0 rows affected (0.00 sec)mysql> select @x
    -> ;
+------+
| @x   |
+------+
|    5 |
+------+
1 row in set (0.00 sec)mysql> SET @poly1 = 'Polygon((@x 0,0 3,3 0,0 0))'; /* 为什么@x在这里无效*/
Query OK, 0 rows affected (0.00 sec)mysql> select AsText(GeomFromText(@poly1)) ;
+------------------------------+
| AsText(GeomFromText(@poly1)) |
+------------------------------+
| NULL                         |
+------------------------------+
1 row in set (0.00 sec)