The SE_MPointFromShape() function
The SE_MPointFromShape() function takes a shape of type multipoint and a spatial reference ID to return an ST_MultiPoint.
Syntax
SE_MPointFromShape(s1 lvarchar, SRID integer)
Return type
ST_MultiPoint
Example
The species_sitings table
is created with three columns. The species and genus columns
uniquely identify each row, while the sitings ST_MultiPoint
stores the locations of the species sitings:
CREATE TABLE species_sitings (species varchar(32),
genus varchar(32),
sitings ST_MultiPoint);
This
code fragment populates the species_sitings table:
/* Create the SQL insert statement to populate the species_sitings
* table. The question marks are parameter markers that indicate
* the column values that will be inserted at run time. */
sprintf(sql_stmt,
"INSERT INTO species_sitings (species,genus,sitings) "
"VALUES(?, ?, SE_MpointFromShape(?, %d))", srid);
/* Prepare the SQL statement for execution. */
rc = SQLPrepare (hstmt, (unsigned char *)sql_stmt, SQL_NTS);
/* Bind the species 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 genus to the second parameter. */
pcbvalue2 = genus_len;
rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_CHAR, genus_len, 0,
genus, genus_len, &pcbvalue2);
/* Bind the sitings geometry to the third parameter. */
pcbvalue3 = sitings_shape_len;
rc = SQLBindParameter (hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_INFX_UDT_LVARCHAR, sitings_shape_len, 0,
sitings_shape_buf, sitings_shape_len, &pcbvalue3);
/* Execute the insert statement. */
rc = SQLExecute (hstmt);