MPolyFromShapeÀº À¯Çü ´ÙÁß ´Ù°ÝÇü ¸ð¾ç°ú °ø°£ ÂüÁ¶ ½Ã½ºÅÛ ½Äº°ÀÚ¸¦ ÃëÇØ ´ÙÁß ´Ù°¢ÇüÀ» ¸®ÅÏÇÕ´Ï´Ù.
±¸¹®
db2gse.MPolyFromShape(ShapeMultiPolygon Blob(1m), SRID db2gse.coordref)
¸®ÅÏ À¯Çü
db2gse.ST_MultiPolygon
¿¹
ÀÌ ÄÚµå Á¶°¢¿¡¼´Â LOTS Å×À̺íÀ» µ¥ÀÌÅÍ »óÁÖ½Ãŵ´Ï´Ù.
LOTS Å×À̺íÀº °¢ ±¸È¹À» °íÀ¯ÇÏ°Ô ½Äº°ÇÏ´Â lot_id¸¦ ÀúÀåÇϰí, ±¸È¹ ¼± ±âÇÏÇÐÀÌ Æ÷ÇÔµÈ ±¸È¹ ´ÙÁß ´Ù°¢ÇüÀ» ÀúÀåÇÕ´Ï´Ù.
CREATE TABLE LOTS ( lot_id integer, lot db2gse.ST_MultiPolygon ); /* lot_id ¹× ±¸È¹À» »óÁÖ½Ã۱â À§ÇÑ SQL insert¹®À» ÀÛ¼ºÇÕ´Ï´Ù. ¹°À½Ç¥´Â ·±Å¸ÀÓ¿¡ °Ë»öµÇ´Â lot ¹× lot_id °ªÀ» ÁöÁ¤ÇÏ´Â ¸Å°³º¯¼ö Ç¥½Ã¹®ÀÚÀÔ´Ï´Ù. */ strcpy (shp_sql,"insert into LOTS (lot_id,lot) values (?, db2gse.MPolyFromShape (cast(? as blob(1m)), db2gse.coordref()..srid(0)))"); /* SQL¹® Çڵ鿡 ´ëÇÑ ¸Þ¸ð¸®¸¦ ÇÒ´çÇϰí, ¸í·É¹® ÇÚµéÀ» ¿¬°á ÇÚµé°ú °áÇÕÇÕ´Ï´Ù. */ rc = SQLAllocStmt (handle, &hstmt); /* ½ÇÇàÇÒ SQL¹®À» ÁغñÇÕ´Ï´Ù. */ rc = SQLPrepare (hstmt, (unsigned char *)shp_sql, SQL_NTS); /* lot_id Á¤¼ö °ªÀ» ù¹øÂ° ¸Å°³º¯¼ö¿¡ ¹ÙÀεåÇÕ´Ï´Ù. */ pcbvalue1 = 0; rc = SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_INTEGER, SQL_INTEGER, 0, 0, &lot_id, 0, &pcbvalue1); /* lot ¸ð¾çÀ» µÎ ¹øÂ° ¸Å°³º¯¼ö¿¡ ¹ÙÀεåÇÕ´Ï´Ù. */ pcbvalue2 = lot_len; rc = SQLBindParameter (hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_BLOB, lot_len, 0, lot_shape, lot_len, &pcbvalue2); /* »ðÀÔ¹®À» ½ÇÇàÇÕ´Ï´Ù. */ rc = SQLExecute (hstmt);