📄 tcbdb.3
字号:
.RS`\fIvals\fR' specifies a list object containing values..RE.RSIf successful, the return value is true, else, it is false..RE.RSIf a record with the same key exists in the database, the new records are placed after the existing one..RE.RE.PPThe function `tcbdbout' is used in order to remove a record of a B+ tree database object..PP.RS.br\fBbool tcbdbout(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..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..RE.RSIf the key of duplicated records is specified, the first one is selected..RE.RE.PPThe function `tcbdbout2' is used in order to remove a string record of a B+ tree database object..PP.RS.br\fBbool tcbdbout2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is true, else, it is false..RE.RSIf the key of duplicated records is specified, the first one is selected..RE.RE.PPThe function `tcbdbout3' is used in order to remove records of a B+ tree database object..PP.RS.br\fBbool tcbdbout3(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..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..RE.RSIf the key of duplicated records is specified, all of them are removed..RE.RE.PPThe function `tcbdbget' is used in order to retrieve a record in a B+ tree database object..PP.RS.br\fBvoid *tcbdbget(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database 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.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 of the corresponding record. `NULL' is returned if no record corresponds..RE.RSIf 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..RE.RE.PPThe function `tcbdbget2' is used in order to retrieve a string record in a B+ tree database object..PP.RS.br\fBchar *tcbdbget2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is the string of the value of the corresponding record. `NULL' is returned if no record corresponds..RE.RSIf 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..RE.RE.PPThe function `tcbdbget3' is used in order to retrieve a record in a B+ tree database object as a volatile buffer..PP.RS.br\fBconst void *tcbdbget3(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database 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.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 of the corresponding record. `NULL' is returned if no record corresponds..RE.RSIf 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..RE.RE.PPThe function `tcbdbget4' is used in order to retrieve records in a B+ tree database object..PP.RS.br\fBTCLIST *tcbdbget4(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database 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 a list object of the values of the corresponding records. `NULL' is returned if no record corresponds..RE.RSBecause 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..RE.RE.PPThe function `tcbdbvnum' is used in order to get the number of records corresponding a key in a B+ tree database object..PP.RS.br\fBint tcbdbvnum(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database 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 the number of the corresponding records, else, it is 0..RE.RE.PPThe function `tcbdbvnum2' is used in order to get the number of records corresponding a string key in a B+ tree database object..PP.RS.br\fBint tcbdbvnum2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is the number of the corresponding records, else, it is 0..RE.RE.PPThe function `tcbdbvsiz' is used in order to get the size of the value of a record in a B+ tree database object..PP.RS.br\fBint tcbdbvsiz(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database 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 the size of the value of the corresponding record, else, it is \-1..RE.RSIf the key of duplicated records is specified, the first one is selected..RE.RE.PPThe function `tcbdbvsiz2' is used in order to get the size of the value of a string record in a B+ tree database object..PP.RS.br\fBint tcbdbvsiz2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIkstr\fR' specifies the string of the key..RE.RSIf successful, the return value is the size of the value of the corresponding record, else, it is \-1..RE.RSIf the key of duplicated records is specified, the first one is selected..RE.RE.PPThe function `tcbdbrange' is used in order to get keys of ranged records in a B+ tree database object..PP.RS.br\fBTCLIST *tcbdbrange(TCBDB *\fIbdb\fB, const void *\fIbkbuf\fB, int \fIbksiz\fB, bool \fIbinc\fB, const void *\fIekbuf\fB, int \fIeksiz\fB, bool \fIeinc\fB, int \fImax\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIbkbuf\fR' specifies the pointer to the region of the key of the beginning border. If it is `NULL', the first record is specified..RE.RS`\fIbksiz\fR' specifies the size of the region of the beginning key..RE.RS`\fIbinc\fR' specifies whether the beginning border is inclusive or not..RE.RS`\fIekbuf\fR' specifies the pointer to the region of the key of the ending border. If it is `NULL', the last record is specified..RE.RS`\fIeksiz\fR' specifies the size of the region of the ending key..RE.RS`\fIeinc\fR' specifies whether the ending border is inclusive or not..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified..RE.RSThe 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..RE.RSBecause 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..RE.RE.PPThe function `tcbdbrange2' is used in order to get string keys of ranged records in a B+ tree database object..PP.RS.br\fBTCLIST *tcbdbrange2(TCBDB *\fIbdb\fB, const char *\fIbkstr\fB, bool \fIbinc\fB, const char *\fIekstr\fB, bool \fIeinc\fB, int \fImax\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIbkstr\fR' specifies the string of the key of the beginning border. If it is `NULL', the first record is specified..RE.RS`\fIbinc\fR' specifies whether the beginning border is inclusive or not..RE.RS`\fIekstr\fR' specifies the string of the key of the ending border. If it is `NULL', the last record is specified..RE.RS`\fIeinc\fR' specifies whether the ending border is inclusive or not..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified..RE.RSThe 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..RE.RSBecause 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..RE.RE.PPThe function `tcbdbfwmkeys' is used in order to get forward matching keys in a B+ tree database object..PP.RS.br\fBTCLIST *tcbdbfwmkeys(TCBDB *\fIbdb\fB, const void *\fIpbuf\fB, int \fIpsiz\fB, int \fImax\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIpbuf\fR' specifies the pointer to the region of the prefix..RE.RS`\fIpsiz\fR' specifies the size of the region of the prefix..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified..RE.RSThe 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..RE.RSBecause 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..RE.RE.PPThe function `tcbdbfwmkeys2' is used in order to get forward matching string keys in a B+ tree database object..PP.RS.br\fBTCLIST *tcbdbfwmkeys2(TCBDB *\fIbdb\fB, const char *\fIpstr\fB, int \fImax\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object..RE.RS`\fIpstr\fR' specifies the string of the prefix..RE.RS`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified..RE.RSThe 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..RE.RSBecause 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..RE.RE.PPThe function `tcbdbaddint' is used in order to add an integer to a record in a B+ tree database object..PP.RS.br\fBint tcbdbaddint(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..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.RS`\fInum\fR' specifies the additional value..RE.RSIf successful, the return value is the summation value, else, it is `INT_MIN'..RE.RSIf 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..RE.RE.PPThe function `tcbdbadddouble' is used in order to add a real number to a record in a B+ tree database object..PP.RS.br\fBdouble tcbdbadddouble(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..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.RS`\fInum\fR' specifies the additional value..RE.RSIf successful, the return value is the summation value, else, it is Not-a-Number..RE.RSIf the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored..RE.RE.PPThe function `tcbdbsync' is used in order to synchronize updated contents of a B+ tree database object with the file and the device..PP.RS.br\fBbool tcbdbsync(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.RSThis function is useful when another process connects to the same database file..RE.RE.PPThe function `tcbdboptimize' is used in order to optimize the file of a B+ tree database object..PP.RS.br\fBbool tcbdboptimize(TCBDB *\fIbdb\fB, int32_t \fIlmemb\fB, int32_t \fInmemb\fB, int64_t \fIbnum\fB, int8_t \fIapow\fB, int8_t \fIfpow\fB, uint8_t \fIopts\fB);\fR.RS`\fIbdb\fR' specifies the B+ tree database object connected as a writer..RE.RS`\fIlmemb\fR' specifies the number of members in each leaf page. If it is not more than 0, the current setting is not changed..RE.RS`\fInmemb\fR' specifies the number of members in each non\-leaf page. If it is not more than 0, the current setting is not changed..RE.RS`\fIbnum\fR' 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..RE.RS`\fIapow\fR' specifies the size of record alignment by power of 2. If it is negative, the current setting is not changed..RE.RS`\fIfpow\fR' 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..RE.RS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -