ST_AsBinary 接受几何图形对象并返回它的公认二进制表示。
语法
db2gse.ST_AsBinary(g db2gse.ST_Geometry)
返回类型
BLOB(1m)
示例
以下代码段说明 ST_AsBinary 函数如何将 BUILDINGFOOTPRINTS 表的占地形状复合多边形转换为 WKB 复合多边形。这些复合多边形被传递给应用程序的 draw_polygon 函数进行显示。
/* Create the SQL expression. */ strcpy(sqlstmt, "select db2gse.ST_AsBinary (footprint) from BUILDINGFOOTPRINTS where db2gse.EnvelopesIntersect(footprint, db2gse.ST_PolyFromWKB(cast(? as blob(1m)), db2gse.coordref()..srid(0)))"); /* Prepare the SQL statement. */ SQLPrepare(hstmt, (UCHAR *)sqlstmt, SQL_NTS); /* Set the pcbvalue1 length of the shape. */ pcbvalue1 = blob_len; /* Bind the shape parameter */ SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_BLOB, blob_len, 0, shape, blob_len, &pcbvalue1); /* Execute the query */ rc = SQLExecute (hstmt); /* Assign the results of the query (the Zone polygons) to the fetched_binary variable. */ SQLBindCol (hstmt, 1, SQL_C_Binary, fetched_binary, 100000, &ind_blob); /* Fetch each polygon within the display window and display it. */ while(SQL_SUCCESS == (rc = SQLFetch(hstmt))) draw_polygon(fetched_binary);