The SE_MPolyFromShape() function

The SE_MPolyFromShape() function takes a shape of type polygon and a spatial reference ID to return an ST_MultiPolygon.

Syntax

SE_MPolyFromShape(s1 lvarchar, SRID integer)

Return type

ST_MultiPolygon

Example

The lots table stores the lot_id, which uniquely identifies each lot, and the lot multipolygon that contains the lot line geometry:
CREATE TABLE lots (lot_id  integer,
                   lot     ST_MultiPolygon);
This code fragment populates the lots table:
/* Create the SQL insert statement to populate the lots table.
     * The question marks are parameter markers that indicate the
     * column values that will be inserted at run time. */
    sprintf(sql_stmt,
            "INSERT INTO lots (lot_id,lot)"
            "VALUES(?, SE_MpolyFromShape(?, %d))", srid);

    /* Prepare the SQL statement for execution. */
    rc = SQLPrepare (hstmt, (unsigned char *)sql_stmt, SQL_NTS);

    /* Bind the lot_id to the first parameter. */
    pcbvalue1 = 0;
    rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG,
                           SQL_INTEGER, 0, 0,
                           &lot_id, 0, &pcbvalue1);

    /* Bind the lot geometry to the second parameter. */
    pcbvalue2 = lot_shape_len;
    rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY,
                           SQL_INFX_UDT_LVARCHAR, lot_shape_len, 0,
                           lot_shape_buf, lot_shape_len, &pcbvalue2);

    /* Execute the insert statement. */
    rc = SQLExecute (hstmt);