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

MPointFromShape

MPointFromShape は、複数ポイント型の形状と地理情報参照システム ID を引き数とし、複数ポイントを戻します。

構文

db2gse.MPointFromShape(ShapeMultiPoint (1M), SRID db2gse.coordref)

戻りタイプ

db2gse.ST_MultiPoint

以下のコード断片では、生物学者の SPECIES_SITINGS 表にデータを入れます。

3 つの列を持つ SPECIES_SITINGS 表が作成されます。 species 列および genus 列はそれぞれの行を一意的に識別し、 sitings 複数ポイント列には種類ごとの生息地域が格納されます。

CREATE TABLE SPECIES_SITINGS (species  varchar(32),
                              genus varchar(32),
                              sitings  db2gse.ST_MultiPoint);
 
/* Create the SQL insert statement to populate the species, genus and
   sitings. The question marks are parameter markers that indicate the
   name and water values that will be retrieved at runtime. */
strcpy (shp_sql,"insert into SPECIES_SITINGS (species,genus,sitings)
values (?,?, db2gse.MPointFromShape (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 varchar species value to the first parameter. */
pcbvalue1 = species_len;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
     SQL_CHAR, species_len, 0, species, species_len, &pcbvalue1);
 
/* Bind the varchar genus value to the second parameter. */
pcbvalue2 = genus_len;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
   SQL_CHAR, genus_len, 0, name, genus_len, &pcbvalue2);
 
/* Bind the shape to the third parameter. */
pcbvalue3 = blob_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
     SQL_BLOB, sitings_len, 0, sitings_shape, sitings_len, &pcbvalue3);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt); 


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