DBcursor->c_put |
#include <db.h>int DBcursor->c_put(DBC *DBcursor, DBT *key, DBT *data, u_int32_t flags);
The DBcursor->c_put method stores key/data pairs into the database.
Unless otherwise specified, the DBcursor->c_put method returns a non-zero error value on failure and 0 on success.
If DBcursor->c_put fails for any reason, the state of the cursor will be unchanged. If DBcursor->c_put succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item.
(Btree and HashÀÇ °æ¿ì,Ä¿¼°¡ ÂüÁ¶ÇÏ°í ÀÖ´Â Å°ÀÇ duplicate ¿ä¼Ò·Î¼ µ¥ÀÌŸ¾ÆÀÌÅÛÀ» »ðÀÔÇÑ´Ù.»õ·Î¿î ¿ä¼Ò´Â ÇöÀç Ä¿¼Æ÷Áö¼Ç ¹Ù·Î Á÷ÈÄ¿¡ ³ªÅ¸³´Ù.µ¥ÀÌŸ¾ÆÀÌÅÛÀÇ duplicate¸¦ Áö¿øÇÏÁö ¾Ê°Ô ¼³Á¤µÈ Btree ¶Ç´Â Hash¿¡¼ DB_AFTER ¸¦ »ç¿ëÇÏ´Â °ÍÀº ¿¡·¯´Ù. Å°ÀÎÀÚ´Â ¹«½ÃµÈ´Ù.)
In the case of the Recno access method, it is an error to specify DB_AFTER if the underlying Recno database was not created with the DB_RENUMBER flag. If the DB_RENUMBER flag was specified, a new key is created, all records after the inserted item are automatically renumbered, and the key of the new record is returned in the structure to which the key parameter refers. The initial value of the key parameter is ignored. See DB->open for more information.
(Recno¿¡¼,DB_RENUMBERÇ÷¡±×·Î ¼³Á¤µÇÁö ¾Ê°í DB_AFTER ¸¦ »ç¿ëÇÏ´Â °ÍÀº ¿¡·¯´Ù.¸¸¾à DB_RENUMBER°¡ ¼³Á¤µÇ¾ú´Ù¸é »õ·Î¿î Å°´Â »ý¼ºµÇ°í »ðÀÔµÈ ·¹ÄÚµå ÈÄÀÇ ¸ðµç ·¹ÄÚµå´Â ÀÚµ¿À¸·Î Àç³Ñ¹ö¸µµÈ´Ù.±×¸®°í »õ·Î¿î ·¹ÄÚµåÀÇ Å°´Â key ÆĶó¹ÌÅÍ°¡ ÂüÁ¶ÇÏ°í ÀÖ´Â ±¸Á¶Ã¼¿¡ ¸®ÅϵȴÙ.Ãʱâ keyÆĶó¹ÌÅÍ´Â ¹«½ÃµÈ´Ù.)
The DB_AFTER flag may not be specified to the Queue access method.
(DB_AFTER ´Â Å¥¿¡ ¼³Á¤µÇÁö ¾Ê¾Æ¾ß ÇÑ´Ù.)
The DBcursor->c_put method will return DB_NOTFOUND if the current cursor record has already been deleted and the underlying access method is Hash.
In the case of the Recno access method, it is an error to specify DB_BEFORE if the underlying Recno database was not created with the DB_RENUMBER flag. If the DB_RENUMBER flag was specified, a new key is created, the current record and all records after it are automatically renumbered, and the key of the new record is returned in the structure to which the key parameter refers. The initial value of the key parameter is ignored. See DB->open for more information.
The DB_BEFORE flag may not be specified to the Queue access method.
The DBcursor->c_put method will return DB_NOTFOUND if the current cursor record has already been deleted and the underlying access method is Hash.
ÁöÁ¤µÈ data¾ÆÀÌÅÛÀ» °¡¸£Å°´Â Ä¿¼À§Ä¡¿¡ key/data pairÀÇ data·Î ´þ¾î¾²¿©Áø´Ù.
The DBcursor->c_put method will return DB_NOTFOUND if the current cursor record has already been deleted and the underlying access method is Hash.
¸¸¾à¿¡ ÇöÀç Ä¿¼ ·¹Äڵ尡 ÀÌ¹Ì Áö¿öÁ³°Å³ª Hash access methodÀÏ °æ¿ì DBcursor-c_put¸Þ¼Òµå´Â DB_NOTFOUND¸¦ ¸®ÅÏÇÒ °ÍÀÌ´Ù.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database and no duplicate sort function has been specified, the inserted data item is added as the first of the data items for that key.
¸¸¾à database°¡ duplicate data¸¦ Áö¿øÇÏ°í key°¡ ÀÌ¹Ì database¿¡ Á¸ÀçÇÏ°í duplicate sort ÇÔ¼ö°¡ ÁöÁ¤µÇ¾ú´Ù¸é »ðÀÔµÈ data ¾ÆÀÌÅÛÀº ±×°ÍÀÇ Á¤·ÄµÈ À§Ä¡¿¡ Ãß°¡µÈ´Ù. ¸¸¾à key°¡ ÀÌ¹Ì database¿¡ Á¸ÀçÇÏ°í duplicate sort ÇÔ¼ö°¡ ÁöÁ¤µÇÁö ¾Ê¾Ò´Ù¸é »ðÀÔµÈ data ¾ÆÀÌÅÛÀº ±× Å°¸¦ À§ÇÑ Ã¹¹ø° data¾ÆÀÌÅÛÀ¸·Î¼ Ãß°¡µÈ´Ù.
The DB_KEYFIRST flag may not be specified to the Queue or Recno access methods.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database, and no duplicate sort function has been specified, the inserted data item is added as the last of the data items for that key.
The DB_KEYLAST flag may not be specified to the Queue or Recno access methods.
Btree¿Í Hash access methodÀÇ °æ¿ì, ¸¸¾à key/data½ÖÀÌ ÀÌ¹Ì database»ó¿¡ Á¸ÀçÇÏ´Â °Í°ú °°Áö ¾Ê´Ù¸é ÁöÁ¤µÈ key/data½ÖÀº database¿¡ »ðÀԵȴÙ. ¸¸¾à key¿Í data½ÎÀÌ database»ó¿¡ Á¸ÀçÇÑ´Ù¸é DB_KEYEXIST°¡ ¸®ÅϵȴÙ. DB_NODUPDATAÇ÷¡±×´Â ¿ÀÁ÷ Á¤·ÄµÈ duplicate data itemsÀÌ Áö¿øµÇ´Â ȯ°æÀ» °®´Â database¿¡¸¸ Çã¶ôµÈ´Ù.
The DB_NODUPDATA flag may not be specified to the Queue or Recno access methods.
The DBcursor->c_put method may fail and return one of the following non-zero errors:
Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.