首先,创建一个表名为geometry2的表,然后增加一个名为gemo的point类型的字段。

insert方法有4中,例如以下所看到的:
//================================================================//
INSERT INTO `geometry2`.`gemo` VALUES(GeomFromText('POINT(1 1)'));

//================================================================//
INSERT INTO `geometry2`.`gemo` VALUES(PointFromText('POINT(1 1)'));

//================================================================//
SET @g = 'POINT(1 1)';
INSERT INTO `geometry2`.`gemo` VALUES(GeomFromText(@g));

//================================================================//
SET @g = GeomFromText('POINT(1 1)');
INSERT INTO `geometry2`.`gemo` VALUES(@g);

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

假设仅仅是用select(*) from gemo,select出来的结果会是乱码···

要想看到非乱码数据,用以下这个方法
//================================================================//
SELECT AsText(pos) FROM `geometry2`.`gemo`;

可得例如以下格式的数据:

mysql空间类型:Point类型的insert和select - Mooner - 楚天空阔歌声长

另附mysql官方站点的手冊:

http://dev.mysql.com/doc/refman/5.1/zh/spatial-extensions-in-mysql.html

05-11 15:26