查询数据库的时候,语句这样写:AsText(point类型的列),如下:
sql = "select AsText(point), x(point), y(point), type, name, status from tb_point"//SQL语句
db1 = new DBHelper(sql)//创建DBHelper对象
try {
ret = db1.pst.executeQuery()//执行语句,得到结果集
while (ret.next()) {
final String point = ret.getString(1)
final String xpoint = ret.getString(2)
final String ypoint = ret.getString(3)
final String type = ret.getString(4)
final String name = ret.getString(5)
final int status = ret.getInt(6)
System.out.println(String.format("%s\t%s\t%s\t%s\t%s\t%d", point, xpoint,ypoint, type,name,status))
}//显示数据
ret.close()
db1.close()//关闭连接
} catch (final SQLException e) {
e.printStackTrace()
}
输出结果:
POINT(123.462202 41.804471) 123.462202 41.804471 ViewPoint Yellow Stone Park 1
POINT(123.462202 41.804471) 123.462202 41.804471 Clinic TangZhen 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)