用户指南和参考

MLine FromShape

MLineFromShape 接受类型为多线条的形状和 Spatial 参考系标识并返回多线条。

语法

db2gse.MLineFromShape(ShapeMultiLineString Blob(1M), cr db2gse.coordref)

返回类型

db2gse.ST_MultiLineString

示例

下列代码段用唯一的 ID、名称和水多线条填充 WATERWAYS 表。

创建具有 ID 列和 NAME 列的 WATERWAYS 表,这些列标识存储在该表中的每个溪流和江河系统。WATER 列为多线条,因为江河和溪流系统通常是几个线条的集合。

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.MLineFromShape (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); 


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