使用者の手引きおよび解説書

ST_MPolyFromWKB

ST_MPolyFromWKB は、複数ポリゴン型の事前割り当てバイナリー表現と地理情報参照システム ID を引き数とし、複数ポリゴンを戻します。

構文

db2gse.ST_MPolyFromWKB(WKBMultiPolygon Blob(1M), SRID 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); 


[ ページのトップ | 前ページ | 次ページ | 目次 | 索引 ]