LineFromShape 接受类型为点的形状和 Spatial 参考系标识并返回线条。
语法
db2gse.Line FromShape(ShapeLineString Blob(1M), cr db2gse.coordref)
返回类型
db2gse.ST_LineString
示例
下列代码段用每个排水管道的唯一 ID、大小类别和几何图形填充 SEWERLINES 表。
该 CREATE TABLE 语句创建 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 (shp_sql,"insert into sewerlines (sewer_id,class,sewer) values (?,?, db2gse.Line FromShape (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 key 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_shape, blob_len, &pcbvalue3); /* Execute the insert statement. */ rc = SQLExecute (hstmt);