DB2 Cube Views ³»Àå ÇÁ·Î½ÃÀú

ÀÌ ³»Àå ÇÁ·Î½ÃÀú´Â md_message¶ó°í Çϸç DB2 Cube Views ¸Å°³º¯¼ö Æ÷¸ËÀ¸·Î Ç¥ÇöµÈ ¸Å°³º¯¼ö¸¦ ó¸®ÇÕ´Ï´Ù. ÀÌ ÇÁ·Î½ÃÀú´Â ÀÔ·Â ¸Å°³º¯¼ö¿¡¼­ ÀÛ¾÷ ¹× ¸ÞŸµ¥ÀÌÅÍ Á¤º¸¸¦ ÃßÃâÇÑ ´ÙÀ½ ¿äûµÈ ¸ÞŸµ¥ÀÌÅÍ ÀÛ¾÷À» ¼öÇàÇÕ´Ï´Ù. ÀÌ ÇÁ·Î½ÃÀú´Â ÀÛ¾÷¿¡ µû¶ó¼­ ¸ÞŸµ¥ÀÌÅÍ Á¤º¸ÀÇ Æ÷ÇÔ¿Ü¿¡µµ ¿äûµÈ ÀÛ¾÷ÀÇ ½ÇÇà »óÅÂ(¼º°ø ¶Ç´Â ½ÇÆÐ)¸¦ Æ÷ÇÔÇÏ´Â Ãâ·Â ¸Å°³º¯¼ö¸¦ ÀÛ¼ºÇÕ´Ï´Ù.

DB2 Cube Views ³»Àå ÇÁ·Î½ÃÀú´Â DB2 ³»Àå ÇÁ·Î½ÃÀú·Î ±¸ÇöµÇ¾î ÀÖ½À´Ï´Ù. ÀÌ ÇÁ·Î½ÃÀú´Â DB2 ÇÁ·Î±×·¡¹Ö ÀÎÅÍÆäÀ̽º¸¦ »ç¿ëÇÏ´Â ÀÀ¿ëÇÁ·Î±×·¥¿¡ ÀÇÇØ »ç¿ëµÉ ¼ö ÀÖ½À´Ï´Ù. ³»Àå ÇÁ·Î½ÃÀúÀÇ À̸§Àº ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÏÁö ¾ÊÀ¸¸ç ¹Ý¸é¿¡ ³»Àå ÇÁ·Î½ÃÀúÀÇ ¸Å°³º¯¼ö ³»¿ëÀº ´ë¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÕ´Ï´Ù. md_message ¹× ÇÁ·ÎÅäŸÀÔÀÇ ±¸¹®Àº ´ÙÀ½ ¿¹Á¦¿¡ Ç¥½ÃµÇ¾î ÀÖ½À´Ï´Ù.

±¸¹®:     call md_message (request, metadata, response)
ÇÁ·ÎÅäŸÀÔ:  md_message (request  IN   CLOB(1M),
                        metadata INOUT  CLOB(1M),
                        response  OUT   CLOB(1M))

request, metadata ¹× response ¸Å°³º¯¼ö´Â DB2 µ¥ÀÌÅÍ À¯ÇüÀÎ CLOB À¯ÇüÀÔ´Ï´Ù. ÀÀ¿ëÇÁ·Î±×·¥Àº request ¸Å°³º¯¼ö¸¦ ¼öÇàÇÒ ÀÛ¾÷ÀÇ ¼³¸íÀ¸·Î ä¿ì°í ¼±ÅÃÀûÀ¸·Î ÀÛ¾÷À» ¼öÇàÇØ¾ß ÇÏ´Â ¸ÞŸµ¥ÀÌÅÍ·Î metadata ¸Å°³º¯¼ö¸¦ ä¿ï ¼ö ÀÖ½À´Ï´Ù. ÀÔ·Â ¸Å°³º¯¼ö¸¦ ¸ðµÎ »ç¿ëÇÑ ÈÄ¿¡, md_message´Â ÀÀ´ä ¸Å°³º¯¼ö·Î ÀÛ¾÷ »óŸ¦ ¸®ÅÏÇÏ°í ¸ÞŸµ¥ÀÌÅÍ ¸Å°³º¯¼ö·Î ¿äûµÈ ¸ÞŸµ¥ÀÌÅ͸¦ ¸®ÅÏÇÕ´Ï´Ù. ¸ÞŸµ¥ÀÌÅÍ ¸Å°³º¯¼ö´Â ¸ÞŸµ¥ÀÌÅÍÀÇ ÀÔ·Â ¹× Ãâ·Â ¸ðµÎ¿¡ ´ëÇØ »ç¿ëµË´Ï´Ù. DB2´Â µ¥ÀÌÅͺ£À̽º ¼­¹ö¿¡¼­ ºñÁî´Ï½º ÀÎÅÚ¸®Àü½º ÀÀ¿ëÇÁ·Î±×·¥°ú md_message ³»Àå ÇÁ·Î½ÃÀú °£ÀÇ ¸Å°³º¯¼ö ±¸Á¶ Àü¼ÛÀ» ó¸®ÇÕ´Ï´Ù.

CLOB ÀμöÀÇ Å©±â´Â ´Ù¾çÇÒ ¼ö ÀÖ½À´Ï´Ù. 1M°¡ ±âº»°ªÀ̸ç sqllib/misc/db2mdapi.sql ½ºÅ©¸³Æ®¿¡¼­ »ç¿ëµË´Ï´Ù. CLOB ¸Å°³º¯¼öÀÇ Å©±â¸¦ ÃÖ´ë 2GB·Î ÁöÁ¤ÇÏ¿© ³»Àå ÇÁ·Î½ÃÀú¸¦ ´Ù½Ã īŻ·Î±×ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¸Å°³º¯¼öÀÇ Å©±â¸¦ Áõ°¡½Ã۸é, ³»Àå ÇÁ·Î½ÃÀú ½ÃÀÛ ½Ã Ãâ·Â ¸Å°³º¯¼ö ¹öÆÛ°¡ īŻ·Î±×µÈ Å©±â·Î ¹Ì¸® ÇÒ´çµÇ±â ¶§¹®¿¡ ·±Å¸ÀÓ ½Ã ³»Àå ÇÁ·Î½ÃÀú°¡ ´õ ¸¹Àº ¸Þ¸ð¸®¸¦ »ç¿ëÇÕ´Ï´Ù. ±× Å©±â°¡ ³Ê¹« ÀÛÀ¸¸é, ÀÔ·Â ¹× Ãâ·Â ¸Å°³º¯¼ö°¡ īŻ·Î±×µÈ Å©±â¸¦ ÃʰúÇÏ´Â °æ¿ì¿¡ ÀÔ·Â ¹× Ãâ·Â ¸Å°³º¯¼ö¿¡¼­ µ¥ÀÌÅͰ¡ Àý´ÜµÉ ¼ö ÀÖ½À´Ï´Ù.

DB2 ³»Àå ÇÁ·Î½ÃÀú¸¦ »ç¿ëÇÏ´Â ÇÁ·Î±×·¥ ÀÛ¼º ¹æ¹ý¿¡ °üÇÑ ¼³¸íÀº DB2 ÀÀ¿ëÇÁ·Î±×·¥ °³¹ß ¾È³»¼­¸¦ ÂüÁ¶ÇϽʽÿÀ. API¸¦ »ç¿ëÇÑ ÇÁ·Î±×·¡¹Ö°ú °ü·ÃµÈ ¹®Á¦Á¡ÀÇ ¼³¸íÀº ÀÀ¿ëÇÁ·Î±×·¥ ÇÁ·Î±×·¥¹Ö ÁÖÀÇ»çÇ×À» ÂüÁ¶ÇϽʽÿÀ.

´ÙÀ½ ¿¹´Â ³»Àå SQL ÀÀ¿ëÇÁ·Î±×·¥¿¡¼­ DB2 Cube Views ³»Àå ÇÁ·Î½ÃÀú¸¦ È£ÃâÇÏ´Â ¹æ¹ýÀ» º¸¿© ÁÝ´Ï´Ù.

±×¸² 29. md_message ³»Àå ÇÁ·Î½ÃÀú¸¦ È£ÃâÇÏ´Â ³»Àå SQL ÀÀ¿ëÇÁ·Î±×·¥ÀÇ ¿¹

// Standard declarations
// ...
 
// Include the Communication Area to access error details
EXEC SQL INCLUDE SQLCA;
 
// SQL declarations of host variables that will be used for calling the
// DB2 Cube Views stored procedure
EXEC SQL BEGIN DECLARE SECTION; 
 
// Allocate CLOB for the request parameter
SQL TYPE is CLOB(1M)       request;
 
// Allocate CLOB for the metadata parameter
SQL TYPE is CLOB(1M)       metadata;
 
// Allocate CLOB for the response parameter
SQL TYPE is CLOB(1M)       response;
 
EXEC SQL END DECLARE SECTION;
 
// Connect to database and other application initializations
// ...
 
// Populate the request parameter structure with the operation
strcpy(request.data, ¡º<request><describe> ... </describe></request>¡»);
 
// string length with end-of-string
request.length = strlen(request.data) + 1;
 
// Populate the metadata parameter structure with the metadata
strcpy(metadata.data, ¡º¡»);
// string length with EOS
metadata.length = strlen(metadata.data) + 1;
 
// Call DB2 Cube Views stored procedure
EXEC SQL CALL ¡ºDB2INFO.MD_MESSAGE¡»(:request,:metadata,:response);
 
// Check that the stored procedure has returned without errors
if (sqlca.sqlcode)
{
// error checking using sqlaintp()
}
 
// Process response parameter structure to determine success of operation
// ...
 
// Process metadata parameter structure to extract requested metadata
// ...
 
// Disconnect from database and other application terminations
// ...