用户指南和参考

ST_MPolyFromWKB

ST_MPolyFromWKB 接受复合多边形类型的公认二进制表示和 Spatial 参考系标识,并返回复合多边形。

语法

db2gse.ST_MPolyFromWKB(WKBMultiPolygon Blob(1M), cr db2gse.coordref)

返回类型

db2gse.ST_MultiPolygon

示例

以下代码段填充 LOTS 表。

LOTS 表存储 LOT_ID(它唯一地标识每个地块)和 LOT 复合多边形(它包含地块线几何图形)。

CREATE TABLE LOTS (  lot_id integer, lot db2gse.ST_MultiPolygon );
 
/* Create the SQL insert statement to populate the lot_id, and lot. The
   question marks are parameter markers that indicate the lot_id, and lot
   values that will be retrieved at runtime. */
strcpy (wkb_sql,"insert into LOTS (lot_id,lot)
values (?, db2gse.ST_MPolyFromWKB (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 *)wkb_sql, SQL_NTS);
 
/* Bind the lot_id integer value to the first parameter. */
pcbvalue1 = 0;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_INTEGER,
     SQL_INTEGER, 0, 0, &lot_id, 0, &pcbvalue1);
 
/* Bind the lot shape to the second parameter. */
pcbvalue2 = lot_len;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY,
     SQL_BLOB, lot_len, 0, lot_wkb, lot_len, &pcbvalue2);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt);


[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]