?? tcbdb.h
字號(hào):
`kstr' specifies the string of the key. `vstr' specifies the string of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, it is overwritten. */bool tcbdbput2(TCBDB *bdb, const char *kstr, const char *vstr);/* Store a new record into a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, this function has no effect. */bool tcbdbputkeep(TCBDB *bdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Store a new string record into a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kstr' specifies the string of the key. `vstr' specifies the string of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, this function has no effect. */bool tcbdbputkeep2(TCBDB *bdb, const char *kstr, const char *vstr);/* Concatenate a value at the end of the existing record in a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If successful, the return value is true, else, it is false. If there is no corresponding record, a new record is created. */bool tcbdbputcat(TCBDB *bdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Concatenate a string value at the end of the existing record in a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kstr' specifies the string of the key. `vstr' specifies the string of the value. If successful, the return value is true, else, it is false. If there is no corresponding record, a new record is created. */bool tcbdbputcat2(TCBDB *bdb, const char *kstr, const char *vstr);/* Store a record into a B+ tree database object with allowing duplication of keys. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, the new record is placed after the existing one. */bool tcbdbputdup(TCBDB *bdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Store a string record into a B+ tree database object with allowing duplication of keys. `bdb' specifies the B+ tree database object connected as a writer. `kstr' specifies the string of the key. `vstr' specifies the string of the value. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, the new record is placed after the existing one. */bool tcbdbputdup2(TCBDB *bdb, const char *kstr, const char *vstr);/* Store records into a B+ tree database object with allowing duplication of keys. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the common key. `ksiz' specifies the size of the region of the common key. `vals' specifies a list object containing values. If successful, the return value is true, else, it is false. If a record with the same key exists in the database, the new records are placed after the existing one. */bool tcbdbputdup3(TCBDB *bdb, const void *kbuf, int ksiz, const TCLIST *vals);/* Remove a record of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `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. If the key of duplicated records is specified, the first one is selected. */bool tcbdbout(TCBDB *bdb, const void *kbuf, int ksiz);/* Remove a string record of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kstr' specifies the string of the key. If successful, the return value is true, else, it is false. If the key of duplicated records is specified, the first one is selected. */bool tcbdbout2(TCBDB *bdb, const char *kstr);/* Remove records of a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `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. If the key of duplicated records is specified, all of them are removed. */bool tcbdbout3(TCBDB *bdb, const void *kbuf, int ksiz);/* Retrieve a record in a B+ tree database object. `bdb' specifies the B+ tree database object. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `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 of the corresponding record. `NULL' is returned if no record corresponds. If the key of duplicated records is specified, the first one is selected. 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 *tcbdbget(TCBDB *bdb, const void *kbuf, int ksiz, int *sp);/* Retrieve a string record in a B+ tree database object. `bdb' specifies the B+ tree database object. `kstr' specifies the string of the key. If successful, the return value is the string of the value of the corresponding record. `NULL' is returned if no record corresponds. If the key of duplicated records is specified, the first one is selected. 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 *tcbdbget2(TCBDB *bdb, const char *kstr);/* Retrieve a record in a B+ tree database object as a volatile buffer. `bdb' specifies the B+ tree database object. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `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 of the corresponding record. `NULL' is returned if no record corresponds. If the key of duplicated records is specified, the first one is selected. 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 *tcbdbget3(TCBDB *bdb, const void *kbuf, int ksiz, int *sp);/* Retrieve records in a B+ tree database object. `bdb' specifies the B+ tree database 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 a list object of the values of the corresponding records. `NULL' is returned if no record corresponds. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. */TCLIST *tcbdbget4(TCBDB *bdb, const void *kbuf, int ksiz);/* Get the number of records corresponding a key in a B+ tree database object. `bdb' specifies the B+ tree database 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 the number of the corresponding records, else, it is 0. */int tcbdbvnum(TCBDB *bdb, const void *kbuf, int ksiz);/* Get the number of records corresponding a string key in a B+ tree database object. `bdb' specifies the B+ tree database object. `kstr' specifies the string of the key. If successful, the return value is the number of the corresponding records, else, it is 0. */int tcbdbvnum2(TCBDB *bdb, const char *kstr);/* Get the size of the value of a record in a B+ tree database object. `bdb' specifies the B+ tree database 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 the size of the value of the corresponding record, else, it is -1. If the key of duplicated records is specified, the first one is selected. */int tcbdbvsiz(TCBDB *bdb, const void *kbuf, int ksiz);/* Get the size of the value of a string record in a B+ tree database object. `bdb' specifies the B+ tree database object. `kstr' specifies the string of the key. If successful, the return value is the size of the value of the corresponding record, else, it is -1. If the key of duplicated records is specified, the first one is selected. */int tcbdbvsiz2(TCBDB *bdb, const char *kstr);/* Get keys of ranged records in a B+ tree database object. `bdb' specifies the B+ tree database object. `bkbuf' specifies the pointer to the region of the key of the beginning border. If it is `NULL', the first record is specified. `bksiz' specifies the size of the region of the beginning key. `binc' specifies whether the beginning border is inclusive or not. `ekbuf' specifies the pointer to the region of the key of the ending border. If it is `NULL', the last record is specified. `eksiz' specifies the size of the region of the ending key. `einc' specifies whether the ending border is inclusive or not. `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified. The return value is a list object of the keys of the corresponding records. This function does never fail and return an empty list even if no record corresponds. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. */TCLIST *tcbdbrange(TCBDB *bdb, const void *bkbuf, int bksiz, bool binc, const void *ekbuf, int eksiz, bool einc, int max);/* Get string keys of ranged records in a B+ tree database object. `bdb' specifies the B+ tree database object. `bkstr' specifies the string of the key of the beginning border. If it is `NULL', the first record is specified. `binc' specifies whether the beginning border is inclusive or not. `ekstr' specifies the string of the key of the ending border. If it is `NULL', the last record is specified. `einc' specifies whether the ending border is inclusive or not. `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified. The return value is a list object of the keys of the corresponding records. This function does never fail and return an empty list even if no record corresponds. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. */TCLIST *tcbdbrange2(TCBDB *bdb, const char *bkstr, bool binc, const char *ekstr, bool einc, int max);/* Get forward matching keys in a B+ tree database object. `bdb' specifies the B+ tree database object. `pbuf' specifies the pointer to the region of the prefix. `psiz' specifies the size of the region of the prefix. `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified. The return value is a list object of the corresponding keys. This function does never fail and return an empty list even if no key corresponds. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. */TCLIST *tcbdbfwmkeys(TCBDB *bdb, const void *pbuf, int psiz, int max);/* Get forward matching string keys in a B+ tree database object. `bdb' specifies the B+ tree database object. `pstr' specifies the string of the prefix. `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified. The return value is a list object of the corresponding keys. This function does never fail and return an empty list even if no key corresponds. Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. */TCLIST *tcbdbfwmkeys2(TCBDB *bdb, const char *pstr, int max);/* Add an integer to a record in a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `num' specifies the additional value. If successful, the return value is the summation value, else, it is `INT_MIN'. If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored. */int tcbdbaddint(TCBDB *bdb, const void *kbuf, int ksiz, int num);/* Add a real number to a record in a B+ tree database object. `bdb' specifies the B+ tree database object connected as a writer. `kbuf' specifies the pointer to the region of the key. `ksiz' specifies the size of the region of the key. `num' specifies the additional value. If successful, the return value is the summation value, else, it is `NAN'.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -