IBM Books

Image, Audio, Video Extender °ü¸® ¹× ÇÁ·Î±×·¡¹Ö

QBIC īŻ·Î±× »ùÇà ÇÁ·Î±×·¥

´ÙÀ½ ±×¸²Àº QBIC īŻ·Î±×¸¦ ÀÛ¼ºÇÏ´Â C·Î ÄÚµùµÈ ÇÁ·Î±×·¥ÀÇ ÀϺθ¦ º¸¿©ÁÝ´Ï´Ù. ÇÁ·Î±×·¥Àº ¶ÇÇÑ À̹ÌÁö Ä÷³À» QBIC īŻ·Î±×·Î īŻ·Î±×È­ÇÕ´Ï´Ù. SAMPLES ¼­ºêµð·ºÅ丮¿¡ ÀÖ´Â QBCATDMO.C ÆÄÀÏ¿¡¼­ ¿ÏÀüÇÑ ÇÁ·Î±×·¥À» ãÀ» ¼ö ÀÖ½À´Ï´Ù. ¿ÏÀüÇÑ ÇÁ·Î±×·¥À» ¼öÇàÇϱâ Àü¿¡ ENABLE ¹× POPULATE »ùÇà ÇÁ·Î±×·¥À» ¼öÇàÇØ¾ß ÇÕ´Ï´Ù(SAMPLES ¼­ºêµð·ºÅ丮¿¡µµ ÀÖÀ½). »ùÇà ÇÁ·Î±×·¥¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ Á¤º¸´Â ºÎ·Ï B, »ùÇà ÇÁ·Î±×·¥ ¹× ¹Ìµð¾î ÆÄÀÏÀ» ÂüÁ¶ÇϽʽÿÀ.

ÇÁ·Î±×·¥¿¡¼­ ´ÙÀ½°ú °°Àº »çÇ×À» ÁÖ¸ñÇϽʽÿÀ.

(1)dmbqbapi Çì´õ ÆÄÀÏ Æ÷ÇÔ.

(2)µ¥ÀÌÅͺ£À̽º¿¡ ¿¬°á.

(3)īŻ·Î±× ÀÛ¼º. īŻ·Î±×´Â ÀÚµ¿ īŻ·Î±×È­°¡ ÀÛµ¿ ÁßÁöµÈ »óÅ·ΠÀÛ¼ºµË´Ï´Ù.

(4)°»½Å¿ëÀ¸·Î īŻ·Î±× ¿­±â.

(5)Æò±Õ »ö»ó Ư¼ºÀ» īŻ·Î±×¿¡ Ãß°¡.

(6)À̹ÌÁö Ä÷³À» īŻ·Î±×È­.

(7)īŻ·Î±× ´Ý±â.

±×¸² 20. QBIC īŻ·Î±× »ùÇà ÇÁ·Î±×·¥

#include <sql.h>
#include <sqlcli.h>
#include <sqlcli1.h>
#include <dmbqbqpi.h> (1)
#include <stdio.h>
 
/****************************************************************************/
/*  Define the function prototypes                                          */
/****************************************************************************/
 
void printError(SQLHSTMT hstmt);
void createCatalog();
void openCatalog();
void closeCatalog();
void addFeature();
void catalogImageColumn();
 
QbCatalogHandle cHdl = 0;
 
static SQLHENV henv;
static SQLHDBC hdbc;
static SQLHSTMT hstmt;
static SQLRETURN rc;
char tableName[] = "sobay_catalog";
char columnName[] = "covers";
 
SQLCHAR uid[18+1];
SQLCHAR pwd[30+1];
SQLCHAR dbnName[SQL_MAX_DSN_LENGTH+1];
 
void main ()
{
/*---- prompt for database name, userid, and password ----*/
  printf("Enter database name:\n");
  gets((char *) dbName);
  printf("Enter userid:\n");
  gets((char *) pwd);
/* set up the SQL CLI environment */
 SQlAllocEnv(&henv);
 SQLAllocConnect(henv, &hdbc);
 rc = SQLConnect(hdbc,dbname,SQL_NTS,uid,SQL_NTS,pwd,SQL_NTS); (2)
 if (rc != SQL_SUCCESS)
 {
  printError(SQL_NULL_HSTMT);
  exit(1);
 }
 createCatalog();
   openCatalog();
   addFeature();
 getCatalogInfo();
 listFeatures();
 catalogImageColumn();
 closeCatalog();
 
 SQLDisconnect(hdbc);
 SQLFreeConnect(hdbc);
 SQLFreeEnv(henv);
}
/**********************************************************************/
void createCatalog()
{
 SQLINTEGER autoCatalog = 0;
 SQLINTEGER retLen;
   SQLINTEGER errCode = 0;
   char errMsg[500];
 
   QbCreateCatalog( (3)
         (char *) tableName,
         (char *) columnName,
         autoCatalog,
         0
        );
 
   DBiGetError(&errCode, errMsg);
   if(errCode) printf("Error code is %d Error Message %s", errCode, errMsg);
}
/**********************************************************************/
void openCatalog()
{
   SQLINTEGER errCode = 0;
   char errMsg[500];
 SQLINTEGER mode = qbiUpdate;
 
   QbOpenCatalog( (4)
         (char *) tableName,
         (char *) columnName,
         mode,
         &cHdl
        );
 
   DBiGetError(&errCode, errMsg);
   if(errCode) printf("Error code is %d Error Message %s", errCode, errMsg);
}
/**********************************************************************/
void addFeature()
{
 SQLINTEGER errCode=0;
 char errMsg[5
 if(cHdl) /* if we have an open catalog, else do nothing */
 {
   char featureName*lbrk.] = "QbColorFeatureClass"; (5)
     QbaddFeature(
         cHdl,
         featureName
        );
 
     DBiGetError(&errCode, errMsg);
     if(errCode) printf("Error code is %d Error Message %s", errCode, errMsg);
 }
 else
 {
  exit(1);
 }
}
/**********************************************************************/
void catalogImageColumn()
{
   SQLINTEGER errCode = 0;
   char errMsg[500];
 
 if(cHdl) /* if we have an open catalog, else do nothing */
 {
  SQLRETURN rc;
    QbCatalogColumn( (6)
         cHdl,
        );
 
    DBiGetError(&errCode, errMsg);
    if(errCode) printf("Error code is %d Error Message %s", errCode, errMsg);
 
 else
 {
  exit(1);
 }
}
/**********************************************************************/
void closeCatalog()
{
 if(cHdl) /* if we have an open catalog, else do nothing */
 {
    QbCloseCatalog( (7)
         cHdl,
        );
 }
}
/**********************************************************************/


[ ÆäÀÌÁöÀÇ ¸Ç À§ | ÀÌÀü ÆäÀÌÁö | ´ÙÀ½ ÆäÀÌÁö | ¸ñÂ÷ | »öÀÎ ]