as_DBMOpenIndexScanTable

Description
À妽º¸¦ ÀÌ¿ëÇØ Æ¯Á¤ °ª°ú matchµÇ´Â ·¹ÄÚµå À§Ä¡·ÎºÎÅÍ Å×À̺íÀÇ ·¹ÄÚµåµéÀ» °Ë»öÇϱâ À§ÇÑ ½ºÄµ °ü¸®ÀÚ¸¦ ÃʱâÈ­ÇÑ´Ù.

Syntax
DBMErr as_DBMOpenIndexScanTable(TableId tableId, IndexFlag indexFlag, FieldData *keyData, ScanId* scanId,);

Parameters
tableId Å×À̺íÀÇ ID
indexFlag  »ç¿ëÇÒ À妽º¸¦ ÁöÁ¤
DBM_PRIM : primary index
DBM_SEC : secondary index
keyDataÀ妽º °Ë»öÀ» À§ÇÑ Å° °ª¿¡ ´ëÇÑ Á¤º¸
scanIdopenµÈ ½ºÄµ ID

Returns
value¼³¸í
DBM_OK¼º°øÀûÀ¸·Î ¼öÇàµÈ °æ¿ì
DBM_TOO_MANY_SCANSÀÌ¹Ì openµÈ ½ºÄµÀÇ ¼ö°¡ NUM_SCANSÀÎ °æ¿ì
DBM_INVALID_TABLE_IDÁÖ¾îÁø Å×À̺í id¸¦ °®´Â Å×À̺íÀÌ Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì
DBM_INVALID_FLAGindexFlag°¡ DBM_PRIMµµ DBM_SECµµ ¾Æ´Ñ °æ¿ì
DBM_SECONDARY_INDEX_NOT_EXISTindexFlag==DBM_SECÀÌ°í secondary index°¡ Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì
DBM_INVALID_KEY_DATA keyData.id¶ó´Â id¸¦ °¡Áö´Â Çʵ尡 Å×ÀÌºí ½ºÅ°¸¶¿¡ ¾ø´Â °æ¿ì,
keyData.typeÀÌ ½ºÅ°¸¶¿Í ÀÏÄ¡ÇÏÁö ¾Ê´Â °æ¿ì
keyData.typeÀÌ blob field ÀÎ °æ¿ì
keyData.lenÀÌ ÀûÀýÇÏÁö ¾ÊÀº °æ¿ì
(0 < keyData.len <= PATTERN_LENÀ̾î¾ß ÇÔ)
DBM_DB_NOT_INITEDµ¥ÀÌŸº£À̽º°¡ ÃʱâÈ­µÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì

Comments
primary³ª secondary À妽º¸¦ »ç¿ëÇÏ¿© ·¹Äڵ带 °Ë»öÇÑ´Ù.
ÁÖ¾îÁø Å° °ª°ú matchµÇ´Â ÃÖÃÊÀÇ ·¹ÄÚµåºÎÅÍ °Ë»öÇÏ°Ô µÈ´Ù.

°Ë»öÇÏ·Á´Â Å° °ªÀÌ ¼ýÀÚÀÏ ¶§´Â exact matchµÇ´Â ·¹Äڵ带 °Ë»öÇÏ°í, ¹®ÀÚ¿­ÀÏ ¶§´Â prefix match µÇ´Â ·¹Äڵ带 °Ë»öÇÑ´Ù.

¸Å°³º¯¼ö¿¡¼­ »ç¿ëµÇ´Â keyDataÀÇ ÀڷᱸÁ¶´Â ´ÙÀ½°ú °°´Ù.
typedef struct {
  FieldIdid;/* »ç¿ëÇÏÁö ¾Ê´Â´Ù */
  FieldDataType  type;
  S32len;/* ¹®ÀÚ¿­ ÇʵåÀÇ °æ¿ì¿¡¸¸ »ç¿ë */
  union {
  S16 int2val;
  S32 int4val;
  P_S8 str;/* ³¡¿¡ .'\0'ÀÌ ÀÖ¾î¾ß ÇÔ */
  }content;
} FieldData;

¶ÇÇÑ À妽º ½ºÄµÀº open½Ã¿¡´Â ÀÏ´Ü key µ¥ÀÌŸ¿Í matchµÇ´Â ÃÖÃÊÀÇ ·¹Äڵ带 ÇöÀç ·¹ÄÚµå·Î ¼³Á¤ÇÏÁö¸¸, ÀÌÈÄ as_DBMGetNextRecordId³ª as_DBMGetPrevRecordId ÇÔ¼ö¸¦ ÅëÇØ ½ºÄµ open½Ã ¼³Á¤µÈ key µ¥ÀÌŸ¿Í matchµÇÁö ¾Ê´Â ·¹ÄÚµåÀÇ IDµµ ±¸ÇÒ ¼ö ÀÖ´Ù.

½ºÄµÀ» openÇÑ ÀÌÈÄ, ÃÖÃʷΠȣÃâµÇ´Â as_DBMGetNextRecordId ¶Ç´Â as_DBMGetPrevRecordId´Â ÁÖ¾îÁø Å°°ª°ú matchµÇ´Â óÀ½ ·¹ÄÚµå ID¸¦ ¹ÝȯÇÑ´Ù(matchµÇ´Â ·¹Äڵ尡 ¾øÀ» ¶§¿¡´Â Å°°ªº¸´Ù Å« ·¹ÄÚµå Áß¿¡¼­ ÃÖ¼Ò°ªÀ» °®´Â ·¹ÄÚµå ID ¹Ýȯ).

Å°°ª(keyData.content.str)ÀÌ NULL('\0')ÀÎ °æ¿ì Áö¿ø. ÀÌ·¯ÇÑ °æ¿ì óÀ½ °á°ú·Î ³ª¿À´Â ·¹ÄÚµå´Â Çʵ尪ÀÌ ¾ø´Â ·¹Äڵ尡 µÈ´Ù.

See Also
as_DBMGetNextRecordId, as_DBMGetPrevRecordId, as_DBMOpenIndexScanCategory

Example
TableId tableId; ScanId scanId;
RecId recId; DBMErr ret=DBM_OK;
int numFields, numExistFields; FieldDataInfo *fieldDataInfo;
FieldData keyData, fieldData;
// Get tableId
// assign the key data for the primary index field
keyData.id=0;
keyData.type=DBM_STRING;
keyData.content.str = Lmalloc( strlen("keyString") + 1);
strcpy(keyData.content.str, "keyString" );
ret = as_DBMOpenIndexScanTable( tableId, DBM_PRIM, keyData, &scanId);
if( ret < DBM_OK ) // error handling
ret = as_DBMGetNumFieldsInTable(tableId, &numFields);
...
/* allocate space for fieldDataInfo */
fieldDataInfo =(FieldDataInfo*)Lmalloc( sizeof(FieldDataInfo) * numFields );
while( (ret = as_DBMGetNextRecordId( scanId, &recId, &numExistFields,
fieldDataInfo) >= DBM_OK ) {
   if( ret == DBM_OK_MATCH )
   // process for the matched record with key string
   if( ret == DBM_OK_UNMATCH )
   // process for the unmatched record with key string
   ...
}