?? tcbdb.h
字號(hào):
If successful, the return value is true, else, it is false. This function is useful when another process connects to the same database file. */bool tcbdbsync(TCBDB *bdb);/* Optimize the file of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `lmemb' specifies the number of members in each leaf page. If it is not more than 0, the current setting is not changed. `nmemb' specifies the number of members in each non-leaf page. If it is not more than 0, the current setting is not changed. `bnum' specifies the number of elements of the bucket array. If it is not more than 0, the default value is specified. The default value is two times of the number of pages. `apow' specifies the size of record alignment by power of 2. If it is negative, the current setting is not changed. `fpow' specifies the maximum number of elements of the free block pool by power of 2. If it is negative, the current setting is not changed. `opts' 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. If successful, the return value is true, else, it is false. This function is useful to reduce the size of the database file with data fragmentation by successive updating. */bool tcbdboptimize(TCBDB *bdb, int32_t lmemb, int32_t nmemb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts);/* Remove all records of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. If successful, the return value is true, else, it is false. */bool tcbdbvanish(TCBDB *bdb);/* Copy the database file of a B+ tree database object. `bdb' specifies the B+ tree database object. `path' specifies the path of the destination file. If it begins with `@', the trailing substring is executed as a command line. If successful, the return value is true, else, it is false. False is returned if the executed command returns non-zero code. The 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. */bool tcbdbcopy(TCBDB *bdb, const char *path);/* Begin the transaction of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. If successful, the return value is true, else, it is false. The 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. */bool tcbdbtranbegin(TCBDB *bdb);/* Commit the transaction of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. If successful, the return value is true, else, it is false. Update in the transaction is fixed when it is committed successfully. */bool tcbdbtrancommit(TCBDB *bdb);/* Abort the transaction of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. If successful, the return value is true, else, it is false. Update in the transaction is discarded when it is aborted. The state of the database is rollbacked to before transaction. */bool tcbdbtranabort(TCBDB *bdb);/* Get the file path of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the path of the database file or `NULL' if the object does not connect to any database file. */const char *tcbdbpath(TCBDB *bdb);/* Get the number of records of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the number of records or 0 if the object does not connect to any database file. */uint64_t tcbdbrnum(TCBDB *bdb);/* Get the size of the database file of a B+ tree database object. `bdb' specifies the B+ tree database object. The return value is the size of the database file or 0 if the object does not connect to any database file. */uint64_t tcbdbfsiz(TCBDB *bdb);/* Create a cursor object. `bdb' specifies the B+ tree database object. The return value is the new cursor object. Note 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. */BDBCUR *tcbdbcurnew(TCBDB *bdb);/* Delete a cursor object. `cur' specifies the cursor object. */void tcbdbcurdel(BDBCUR *cur);/* Move a cursor object to the first record. `cur' specifies the cursor object. If successful, the return value is true, else, it is false. False is returned if there is no record in the database. */bool tcbdbcurfirst(BDBCUR *cur);/* Move a cursor object to the last record. `cur' specifies the cursor object. If successful, the return value is true, else, it is false. False is returned if there is no record in the database. */bool tcbdbcurlast(BDBCUR *cur);/* Move a cursor object to the front of records corresponding a key. `cur' specifies the cursor object. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition. The cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist. */bool tcbdbcurjump(BDBCUR *cur, const void *kbuf, int ksiz);/* Move a cursor object to the front of records corresponding a key string. `cur' specifies the cursor object. `kstr' specifies the string of the key. If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition. The cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist. */bool tcbdbcurjump2(BDBCUR *cur, const char *kstr);/* Move a cursor object to the previous record. `cur' specifies the cursor object. If successful, the return value is true, else, it is false. False is returned if there is no previous record. */bool tcbdbcurprev(BDBCUR *cur);/* Move a cursor object to the next record. `cur' specifies the cursor object. If successful, the return value is true, else, it is false. False is returned if there is no next record. */bool tcbdbcurnext(BDBCUR *cur);/* Insert a record around a cursor object. `cur' specifies the cursor object of writer connection. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. `cpmode' 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. If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position. After insertion, the cursor is moved to the inserted record. */bool tcbdbcurput(BDBCUR *cur, const void *vbuf, int vsiz, int cpmode);/* Insert a string record around a cursor object. `cur' specifies the cursor object of writer connection. `vstr' specifies the string of the value. `cpmode' 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. If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position. After insertion, the cursor is moved to the inserted record. */bool tcbdbcurput2(BDBCUR *cur, const char *vstr, int cpmode);/* Remove the record where a cursor object is. `cur' specifies the cursor object of writer connection. If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position. After deletion, the cursor is moved to the next record if possible. */bool tcbdbcurout(BDBCUR *cur);/* Get the key of the record where the cursor object is. `cur' specifies the cursor object. `sp' specifies the pointer to the variable into which the size of the region of the return value is assigned. If 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. Because 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. */void *tcbdbcurkey(BDBCUR *cur, int *sp);/* Get the key string of the record where the cursor object is. `cur' specifies the cursor object. If successful, the return value is the string of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position. 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. */char *tcbdbcurkey2(BDBCUR *cur);/* Get the key of the record where the cursor object is, as a volatile buffer. `cur' specifies the cursor object. `sp' specifies the pointer to the variable into which the size of the region of the return value is assigned. If 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. Because 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. */const void *tcbdbcurkey3(BDBCUR *cur, int *sp);/* Get the value of the record where the cursor object is. `cur' specifies the cursor object. `sp' specifies the pointer to the variable into which the size of the region of the return value is assigned. If 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. Because 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. */void *tcbdbcurval(BDBCUR *cur, int *sp);/* Get the value string of the record where the cursor object is. `cur' specifies the cursor object. If successful, the return value is the string of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position. 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. */char *tcbdbcurval2(BDBCUR *cur);/* Get the value of the record where the cursor object is, as a volatile buffer. `cur' specifies the cursor object. `sp' specifies the pointer to the variable into which the size of the region of the return value is assigned. If 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. Because 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. */const void *tcbdbcurval3(BDBCUR *cur, int *sp);/* Get the key and the value of the record where the cursor object is. `cur' specifies the cursor object. `kxstr' specifies the object into which the key is wrote down. `vxstr' specifies the object into which the value is wrote down. If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position. */bool tcbdbcurrec(BDBCUR *cur, TCXSTR *kxstr, TCXSTR *vxstr);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -