Download IBM Informix Spatial Data User's Guide

Transcript
SQL_INTEGER, 0, 0,
&sewer_id, 0, &pcbvalue1);
/* Bind the sewer_class to the second parameter. */
pcbvalue2 = 0;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG,
SQL_INTEGER, 0, 0,
&sewer_class, 0, &pcbvalue2);
/* Bind the sewer geometry to the third parameter. */
pcbvalue3 = sewer_shape_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_INFX_UDT_LVARCHAR, sewer_shape_len, 0,
sewer_shape_buf, sewer_shape_len, &pcbvalue3);
/* Execute the insert statement. */
rc = SQLExecute (hstmt);
The ST_LineFromText() function
The ST_LineFromText() function takes a well-known text representation of type
ST_LineString and a spatial reference ID and returns an ST_LineString.
Syntax
ST_LineFromText(WKT lvarchar, SRID integer)
Return type
ST_LineString
Example
The linestring_test table is created with a single ln1 ST_LineString column:
CREATE TABLE linestring_test (ln1 ST_LineString);
The following INSERT statement inserts an ST_LineString into the ln1 column
using the ST_LineFromText() function:
INSERT INTO linestring_test VALUES(
ST_LineFromText(’linestring(10.01 20.03,20.94 21.34,35.93 19.04)’,1000)
);
The ST_LineFromWKB() function
The ST_LineFromWKB() function takes a well-known binary representation of
type ST_LineString and a spatial reference ID, returning an ST_LineString.
Syntax
ST_LineFromWKB(wkb lvarchar, SRID integer)
Return type
ST_LineString
Chapter 8. Spatial functions
8-63