[postgis-users] insert into a geometry field from 4gl

Markus Schaber schabi at logix-tt.com
Thu Feb 23 00:20:21 PST 2006


Hi, Fay,

Fay Du wrote:

> INSERT INTO gps_log (uid, geom_pt) values ('test1',
> geomfromtext('POINT(1870391 320462)',-1));

This works fine.
> LET sql_stmt = "INSERT INTO gps_log  (uid,geom_pt) Values (?,?)"
>    PREPARE insert_gps_tb FROM sql_stmt
> 
> LET Uid=”test”
> 
> LET gps_point = “geomfromtext('POINT(1870391 320462)',-1)”
> 
> EXECUTE insert_gps_tb USING uid, gps_point

This inserts the whole "geomfromtext('POINT(1870391 320462)',-1)" as
textual geometry representation.

Try this:

LET sql_stmt =
  "INSERT INTO gps_log  (uid,geom_pt) Values (?,geomFromText(?,-1))"
PREPARE insert_gps_tb FROM sql_stmt
LET Uid=”test”
LET gps_point = “'POINT(1870391 320462)'”
EXECUTE insert_gps_tb USING uid, gps_point

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



More information about the postgis-users mailing list