?? tcbdb.3
字號:
`\fIopts\fR' specifies options by bitwise-or: `BDBTLARGE' specifies that the size of the database can be larger than 2GB by using 64\-bit bucket array, `BDBTDEFLATE' specifies that each record is compressed with Deflate encoding, `BDBTBZIP' specifies that each page is compressed with BZIP2 encoding, `BDBTTCBS' specifies that each page is compressed with TCBS encoding. If it is `UINT8_MAX', the current setting is not changed..RE.RSIf successful, the return value is true, else, it is false..RE.RSThis function is useful to reduce the size of the database file with data fragmentation by successive updating..RE.RE.PPThe function `tcbdbvanish' is used in order to remove all records of a B+ tree database object..PP.RS.br\fBbool tcbdbvanish(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RSIf successful, the return value is true, else, it is false..RE.RE.PPThe function `tcbdbcopy' is used in order to copy the database file of a B+ tree database object..PP.RS.br\fBbool tcbdbcopy(TCBDB *\fIbdb\fB, const char *\fIpath\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIpath\fR' specifies the path of the destination file. If it begins with `@', the trailing substring is executed as a command line..RE.RSIf successful, the return value is true, else, it is false. False is returned if the executed command returns non\-zero code..RE.RSThe database file is assured to be kept synchronized and not modified while the copying or executing operation is in progress. So, this function is useful to create a backup file of the database file..RE.RE.PPThe function `tcbdbtranbegin' is used in order to begin the transaction of a B+ tree database object..PP.RS.br\fBbool tcbdbtranbegin(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RSIf successful, the return value is true, else, it is false..RE.RSThe database is locked by the thread while the transaction so that only one transaction can be activated with a database object at the same time. Thus, the serializable isolation level is assumed if every database operation is performed in the transaction. Because all pages are cached on memory while the transaction, the amount of referred records is limited by the memory capacity. If the database is closed during transaction, the transaction is aborted implicitly..RE.RE.PPThe function `tcbdbtrancommit' is used in order to commit the transaction of a B+ tree database object..PP.RS.br\fBbool tcbdbtrancommit(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RSIf successful, the return value is true, else, it is false..RE.RSUpdate in the transaction is fixed when it is committed successfully..RE.RE.PPThe function `tcbdbtranabort' is used in order to abort the transaction of a B+ tree database object..PP.RS.br\fBbool tcbdbtranabort(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RSIf successful, the return value is true, else, it is false..RE.RSUpdate in the transaction is discarded when it is aborted. The state of the database is rollbacked to before transaction..RE.RE.PPThe function `tcbdbpath' is used in order to get the file path of a B+ tree database object..PP.RS.br\fBconst char *tcbdbpath(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RSThe return value is the path of the database file or `NULL' if the object does not connect to any database file..RE.RE.PPThe function `tcbdbrnum' is used in order to get the number of records of a B+ tree database object..PP.RS.br\fBuint64_t tcbdbrnum(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RSThe return value is the number of records or 0 if the object does not connect to any database file..RE.RE.PPThe function `tcbdbfsiz' is used in order to get the size of the database file of a B+ tree database object..PP.RS.br\fBuint64_t tcbdbfsiz(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RSThe return value is the size of the database file or 0 if the object does not connect to any database file..RE.RE.PPThe function `tcbdbcurnew' is used in order to create a cursor object..PP.RS.br\fBBDBCUR *tcbdbcurnew(TCBDB *\fIbdb\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RSThe return value is the new cursor object..RE.RSNote that the cursor is available only after initialization with the `tcbdbcurfirst' or the `tcbdbcurjump' functions and so on. Moreover, the position of the cursor will be indefinite when the database is updated after the initialization of the cursor..RE.RE.PPThe function `tcbdbcurdel' is used in order to delete a cursor object..PP.RS.br\fBvoid tcbdbcurdel(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RE.PPThe function `tcbdbcurfirst' is used in order to move a cursor object to the first record..PP.RS.br\fBbool tcbdbcurfirst(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no record in the database..RE.RE.PPThe function `tcbdbcurlast' is used in order to move a cursor object to the last record..PP.RS.br\fBbool tcbdbcurlast(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no record in the database..RE.RE.PPThe function `tcbdbcurjump' is used in order to move a cursor object to the front of records corresponding a key..PP.RS.br\fBbool tcbdbcurjump(BDBCUR *\fIcur\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIkbuf\fR' specifies the pointer to the region of the key..RE.RS`\fIksiz\fR' specifies the size of the region of the key..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition..RE.RSThe cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist..RE.RE.PPThe function `tcbdbcurjump2' is used in order to move a cursor object to the front of records corresponding a key string..PP.RS.br\fBbool tcbdbcurjump2(BDBCUR *\fIcur\fB, const char *\fIkstr\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition..RE.RSThe cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist..RE.RE.PPThe function `tcbdbcurprev' is used in order to move a cursor object to the previous record..PP.RS.br\fBbool tcbdbcurprev(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no previous record..RE.RE.PPThe function `tcbdbcurnext' is used in order to move a cursor object to the next record..PP.RS.br\fBbool tcbdbcurnext(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is true, else, it is false. False is returned if there is no next record..RE.RE.PPThe function `tcbdbcurput' is used in order to insert a record around a cursor object..PP.RS.br\fBbool tcbdbcurput(BDBCUR *\fIcur\fB, const void *\fIvbuf\fB, int \fIvsiz\fB, int \fIcpmode\fB);\fR.RS`\fIcur\fR' specifies the cursor object of writer connection..RE.RS`\fIvbuf\fR' specifies the pointer to the region of the value..RE.RS`\fIvsiz\fR' specifies the size of the region of the value..RE.RS`\fIcpmode\fR' specifies detail adjustment: `BDBCPCURRENT', which means that the value of the current record is overwritten, `BDBCPBEFORE', which means that the new record is inserted before the current record, `BDBCPAFTER', which means that the new record is inserted after the current record..RE.RSIf successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position..RE.RSAfter insertion, the cursor is moved to the inserted record..RE.RE.PPThe function `tcbdbcurput2' is used in order to insert a string record around a cursor object..PP.RS.br\fBbool tcbdbcurput2(BDBCUR *\fIcur\fB, const char *\fIvstr\fB, int \fIcpmode\fB);\fR.RS`\fIcur\fR' specifies the cursor object of writer connection..RE.RS`\fIvstr\fR' specifies the string of the value..RE.RS`\fIcpmode\fR' specifies detail adjustment: `BDBCPCURRENT', which means that the value of the current record is overwritten, `BDBCPBEFORE', which means that the new record is inserted before the current record, `BDBCPAFTER', which means that the new record is inserted after the current record..RE.RSIf successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position..RE.RSAfter insertion, the cursor is moved to the inserted record..RE.RE.PPThe function `tcbdbcurout' is used in order to remove the record where a cursor object is..PP.RS.br\fBbool tcbdbcurout(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object of writer connection..RE.RSIf successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position..RE.RSAfter deletion, the cursor is moved to the next record if possible..RE.RE.PPThe function `tcbdbcurkey' is used in order to get the key of the record where the cursor object is..PP.RS.br\fBchar *tcbdbcurkey(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcbdbcurkey2' is used in order to get the key string of the record where the cursor object is..PP.RS.br\fBchar *tcbdbcurkey2(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is the string of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcbdbcurkey3' is used in order to get the key of the record where the cursor object is, as a volatile buffer..PP.RS.br\fBconst char *tcbdbcurkey3(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is volatile and it may be spoiled by another operation of the database, the data should be copied into another involatile buffer immediately..RE.RE.PPThe function `tcbdbcurval' is used in order to get the value of the record where the cursor object is..PP.RS.br\fBchar *tcbdbcurval(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcbdbcurval2' is used in order to get the value string of the record where the cursor object is..PP.RS.br\fBchar *tcbdbcurval2(BDBCUR *\fIcur\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RSIf successful, the return value is the string of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use..RE.RE.PPThe function `tcbdbcurval3' is used in order to get the value of the record where the cursor object is, as a volatile buffer..PP.RS.br\fBconst char *tcbdbcurval3(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned..RE.RSIf successful, the return value is the pointer to the region of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position..RE.RSBecause an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is volatile and it may be spoiled by another operation of the database, the data should be copied into another involatile buffer immediately..RE.RE.PPThe function `tcbdbcurrec' is used in order to get the key and the value of the record where the cursor object is..PP.RS.br\fBbool tcbdbcurrec(BDBCUR *\fIcur\fB, TCXSTR *\fIkxstr\fB, TCXSTR *\fIvxstr\fB);\fR.RS`\fIcur\fR' specifies the cursor object..RE.RS`\fIkxstr\fR' specifies the object into which the key is wrote down..RE.RS`\fIvxstr\fR' specifies the object into which the value is wrote down..RE.RSIf successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position..RE.RE.SH SEE ALSO.PP.BR tcbtest (1),.BR tcbmttest (1),.BR tcbmgr (1),.BR tokyocabinet (3)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -