用户指南和参考

ST_LineFromWKB

ST_LineFromWKB 接受线条类型的公认二进制表示和 Spatial 参考系标识,并返回线条。

语法

db2gse.ST_LineFromWKB(WKBLineString Blob(1M), cr db2gse.coordref)

返回类型

db2gse.ST_LineString

示例

下列代码段用每个排水管道的唯一 ID、大小类别和几何图形填充 SEWERLINES 表。

创建具有三列的 SEWERLINES 表。第一列 SEWER_ID 唯一地标识每条排水管道。 第二列 CLASS 为整数类型,标识排水管道的类型,它通常与管道的能力相关。 第三列 SEWER 为线条类型,存储排水管道的几何图形。

CREATE TABLE SEWERLINES (sewer_id   integer,
                         class  integer,
                         sewer  db2gse.ST_LineString);
 
/* Create the SQL insert statement to populate the sewer_id, size class
   and the sewer linestring. The question marks are parameter markers that
   indicate the sewer_id, class and sewer geometry values that will be
   retrieved at runtime. */
strcpy (wkb_sql,"insert into sewerlines (sewer_id,class,sewer)
values (?,?, db2gse.ST_LineFromWKB (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 integer sewer_id value to the first parameter. */
pcbvalue1 = 0;
rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG,
   SQL_INTEGER, 0, 0, &sewer_id, 0, &pcbvalue1);
 
/* Bind the integer class value to the second parameter. */
pcbvalue2 = 0;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_SLONG,
   SQL_INTEGER, 0, 0, &sewer_class, 0, &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, sewer_wkb, blob_len, &pcbvalue3);
 
/* Execute the insert statement. */
rc = SQLExecute (hstmt); 


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