开发者

How to use mysql spatial with prepared statements

开发者 https://www.devze.com 2023-04-10 05:50 出处:网络
I\'ve got two scenarios, using the following statement: INSERT INTO areas (name, polygon) VALUES (开发者_如何学编程?, POLYGON(?,?,?,?,?,?))

I've got two scenarios, using the following statement:

 INSERT INTO areas (name, polygon) VALUES (开发者_如何学编程?, POLYGON(?,?,?,?,?,?))

Will result in errors like this:

Illegal non geometric ''58.03665463092348 14.974815566795314'' value found during parsing

What seems to be the problem here is that my lat and longitudes are quoted as texts within the POLYGON().

However,according to the WKT format I need another set of () in my statement:

  INSERT INTO areas (name, polygon) VALUES (?, POLYGON((?,?,?,?,?,?)))

which will only result in the following error:

 Operand should contain 1 column(s)

I'm at a loss here, how do I use prepared statements along with mysql spatial information?

0

精彩评论

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