User's Guide and Reference

ST_MLineFromWKB

ST_MLineFromWKB takes a well-known binary representation of type multilinestring and a spatial reference system identity and returns a multilinestring.

Syntax

db2gse.ST_MLineFromWKB(WKBMultiLineString Blob(1M), cr db2gse.coordref)

Return type

db2gse.ST_MultiLineString

Examples

The following code fragment populates the WATERWAYS table with a unique id, a name, and a water multilinestring.

The WATERWAYS table is created with the ID and NAME columns, which identify each stream and river system stored in the table. The WATER column is a multilinestring because the river and stream systems are often an aggregate of several linestrings.

CREATE TABLE WATERWAYS (id        integer,
                             name       varchar(128),
                             water      db2gse.ST_MultiLineString);
 
/* Create the SQL insert statement to populate the id, name and
   multilinestring. The question marks are parameter markers that
   indicate the id, name and water values that will be retrieved at
   runtime. */
strcpy (shp_sql,"insert into WATERWAYS (id,name,water)
values (?,?, db2gse.ST_MLineFromWKB (cast(? as blob(1m)),
db2gse.coordref()..srid(0)))");
 
/* Allocate memory for the SQL statement handle and associate the
   statement handle with the connection handle. */
rc = SQLAllocStmt (handle, &hstmt);
 
/* Prepare the SQL statement for execution. */
rc = SQLPrepare (hstmt, (unsigned char *)shp_sql, SQL_NTS);
 
/* Bind the integer id value to the first parameter. */
pcbvalue1 = 0;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG,
   SQL_INTEGER, 0, 0, &id, 0, &pcbvalue1);
 
/* Bind the varchar name value to the second parameter. */
pcbvalue2 = name_len;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
     SQL_CHAR, name_len, 0, &name, name_len, &pcbvalue2);
 
/* Bind the shape to the third parameter. */
pcbvalue3 = blob_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
     SQL_BLOB, blob_len, 0, water_shape, blob_len, &pcbvalue3);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt);


[ Top of Page | Previous Page | Next Page ]