📄 tcfdb.h
字号:
/* Store a string record with a decimal key into a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kstr' specifies the string of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "prev", the number less by one than the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If it is "next", the number greater by one than the maximum ID number of existing records is specified. `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 tcfdbput3(TCFDB *fdb, const char *kstr, const void *vstr);/* Store a new record into a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDPREV', the number less by one than the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. If it is `FDBIDNEXT', the number greater by one than the maximum ID number of existing records is specified. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If the size of the value is greater than the width tuning parameter of the database, the size is cut down to the width. 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 tcfdbputkeep(TCFDB *fdb, int64_t id, const void *vbuf, int vsiz);/* Store a new record with a decimal key into a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kbuf' specifies the pointer to the region of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "prev", the number less by one than the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If it is "next", the number greater by one than the maximum ID number of existing records is specified. `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 the size of the value is greater than the width tuning parameter of the database, the size is cut down to the width. 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 tcfdbputkeep2(TCFDB *fdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Store a new string record with a decimal key into a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kstr' specifies the string of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "prev", the number less by one than the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If it is "next", the number greater by one than the maximum ID number of existing records is specified. `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 tcfdbputkeep3(TCFDB *fdb, const char *kstr, const void *vstr);/* Concatenate a value at the end of the existing record in a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDPREV', the number less by one than the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. If it is `FDBIDNEXT', the number greater by one than the maximum ID number of existing records is specified. `vbuf' specifies the pointer to the region of the value. `vsiz' specifies the size of the region of the value. If the size of the value is greater than the width tuning parameter of the database, the size is cut down to the width. If successful, the return value is true, else, it is false. If there is no corresponding record, a new record is created. */bool tcfdbputcat(TCFDB *fdb, int64_t id, const void *vbuf, int vsiz);/* Concatenate a value with a decimal key in a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kbuf' specifies the pointer to the region of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "prev", the number less by one than the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If it is "next", the number greater by one than the maximum ID number of existing records is specified. `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 the size of the value is greater than the width tuning parameter of the database, the size is cut down to the width. If successful, the return value is true, else, it is false. If there is no corresponding record, a new record is created. */bool tcfdbputcat2(TCFDB *fdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);/* Concatenate a string value with a decimal key in a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kstr' specifies the string of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "prev", the number less by one than the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If it is "next", the number greater by one than the maximum ID number of existing records is specified. `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 tcfdbputcat3(TCFDB *fdb, const char *kstr, const void *vstr);/* Remove a record of a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. If successful, the return value is true, else, it is false. */bool tcfdbout(TCFDB *fdb, int64_t id);/* Remove a record with a decimal key of a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kbuf' specifies the pointer to the region of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. `ksiz' specifies the size of the region of the key. If successful, the return value is true, else, it is false. */bool tcfdbout2(TCFDB *fdb, const void *kbuf, int ksiz);/* Remove a string record with a decimal key of a fixed-length database object. `fdb' specifies the fixed-length database object connected as a writer. `kstr' specifies the string of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If successful, the return value is true, else, it is false. */bool tcfdbout3(TCFDB *fdb, const char *kstr);/* Retrieve a record in a fixed-length database object. `fdb' specifies the fixed-length database object. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. `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. 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 *tcfdbget(TCFDB *fdb, int64_t id, int *sp);/* Retrieve a record with a decimal key in a fixed-length database object. `fdb' specifies the fixed-length database object. `kbuf' specifies the pointer to the region of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. `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. 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 *tcfdbget2(TCFDB *fdb, const void *kbuf, int ksiz, int *sp);/* Retrieve a string record with a decimal key in a fixed-length database object. `fdb' specifies the fixed-length database object. `kstr' specifies the string of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. If successful, the return value is the string of the value of the corresponding record. `NULL' is returned if no record corresponds. 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. */char *tcfdbget3(TCFDB *fdb, const char *kstr);/* Retrieve a record in a fixed-length database object and write the value into a buffer. `fdb' specifies the fixed-length database object. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. `vbuf' specifies the pointer to the buffer into which the value of the corresponding record is written. `max' specifies the size of the buffer. If successful, the return value is the size of the written data, else, it is -1. -1 is returned if no record corresponds to the specified key. Note that an additional zero code is not appended at the end of the region of the writing buffer. */int tcfdbget4(TCFDB *fdb, int64_t id, void *vbuf, int max);/* Get the size of the value of a record in a fixed-length database object. `fdb' specifies the fixed-length database object. `id' specifies the ID number. It should be more than 0. If it is `FDBIDMIN', the minimum ID number of existing records is specified. If it is `FDBIDMAX', the maximum ID number of existing records is specified. If successful, the return value is the size of the value of the corresponding record, else, it is -1. */int tcfdbvsiz(TCFDB *fdb, int64_t id);/* Get the size of the value with a decimal key in a fixed-length database object. `fdb' specifies the fixed-length database object. `kbuf' specifies the pointer to the region of the decimal key. It should be more than 0. If it is "min", the minimum ID number of existing records is specified. If it is "max", the maximum ID number of existing records is specified. `ksiz' specifies the size of the region of the key.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -