📄 curia.3
字号:
.B int crvsiz(CURIA *curia, const char *kbuf, int ksiz);`curia' specifies a database handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. If successful, the return value is the size of the value of the corresponding record, else, it is \-1. Because this function does not read the entity of a record, it is faster than `crget'..PPThe function `criterinit' is used in order to initialize the iterator of a database handle..TP.B int criterinit(CURIA *curia);`curia' specifies a database handle. If successful, the return value is true, else, it is false. The iterator is used in order to access the key of every record stored in a database..PPThe function `criternext' is used in order to get the next key of the iterator..TP.B char *criternext(CURIA *curia, int *sp);`curia' specifies a database handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record is to be get out of the iterator. 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 if it is no longer in use. It is possible to access every record by iteration of calling this function. However, it is not assured if updating the database is occurred while the iteration. Besides, the order of this traversal access method is arbitrary, so it is not assured that the order of storing matches the one of the traversal access..PPThe function `crsetalign' is used in order to set alignment of a database handle..TP.B int crsetalign(CURIA *curia, int align);`curia' specifies a database handle connected as a writer. `align' specifies the size of alignment. If successful, the return value is true, else, it is false. If alignment is set to a database, the efficiency of overwriting values are improved. The size of alignment is suggested to be average size of the values of the records to be stored. If alignment is positive, padding whose size is multiple number of the alignment is placed. If alignment is negative, as `vsiz' is the size of a value, the size of padding is calculated with `(vsiz / pow(2, abs(align) \- 1))'. Because alignment setting is not saved in a database, you should specify alignment every opening a database..PPThe function `crsync' is used in order to synchronize updating contents with the files and the devices..TP.B int crsync(CURIA *curia);`curia' specifies a database handle connected as a writer. If successful, the return value is true, else, it is false. This function is useful when another process uses the connected database directory..PPThe function `croptimize' is used in order to optimize a database..TP.B int croptimize(CURIA *curia, int bnum);`curia' specifies a database handle connected as a writer. `bnum' specifies the number of the elements of each bucket array. If it is not more than 0, the default value is specified. In an alternating succession of deleting and storing with overwrite or concatenate, dispensable regions accumulate. This function is useful to do away with them..PPThe function `crname' is used in order to get the name of a database..TP.B char *crname(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the pointer to the region of the name of the database, else, it is `NULL'. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use..PPThe function `crfsiz' is used in order to get the total size of database files..TP.B int crfsiz(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the total size of the database files, else, it is \-1..PPThe function `crbnum' is used in order to get the total number of the elements of each bucket array..TP.B int crbnum(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the total number of the elements of each bucket array, else, it is \-1..PPThe function `crbusenum' is used in order to get the total number of the used elements of each bucket array..TP.B int crbusenum(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the total number of the used elements of each bucket array, else, it is \-1. This function is inefficient because it accesses all elements of each bucket array..PPThe function `crrnum' is used in order to get the number of the records stored in a database..TP.B int crrnum(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the number of the records stored in the database, else, it is \-1..PPThe function `crwritable' is used in order to check whether a database handle is a writer or not..TP.B int crwritable(CURIA *curia);`curia' specifies a database handle. The return value is true if the handle is a writer, false if not..PPThe function `crfatalerror' is used in order to check whether a database has a fatal error or not..TP.B int crfatalerror(CURIA *curia);`curia' specifies a database handle. The return value is true if the database has a fatal error, false if not..PPThe function `crinode' is used in order to get the inode number of a database directory..TP.B int crinode(CURIA *curia);`curia' specifies a database handle. The return value is the inode number of the database directory..PPThe function `crremove' is used in order to remove a database directory..TP.B int crremove(const char *name);`name' specifies the name of a database directory. If successful, the return value is true, else, it is false..PPThe function `crputlob' is used in order to store a large object..TP.B int crputlob(CURIA *curia, const char *kbuf, int ksiz, const char *vbuf, int vsiz, int dmode);`curia' specifies a database handle connected as a writer. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. `vbuf' specifies the pointer to the region of a value. `vsiz' specifies the size of the region of the value. If it is negative, the size is assigned with `strlen(vbuf)'. `dmode' specifies behavior when the key overlaps, by the following values: `CR_DOVER', which means the specified value overwrites the existing one, `CR_DKEEP', which means the existing value is kept, `CR_DCAT', which means the specified value is concatenated at the end of the existing value. If successful, the return value is true, else, it is false..PPThe function `croutlob' is used in order to delete a large object..TP.B int croutlob(CURIA *curia, const char *kbuf, int ksiz);`curia' specifies a database handle connected as a writer. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. If successful, the return value is true, else, it is false. false is returned when no large object corresponds to the specified key..PPThe function `crgetlob' is used in order to retrieve a large object..TP.B char *crgetlob(CURIA *curia, const char *kbuf, int ksiz, int start, int max, int *sp);`curia' specifies a database handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. `start' specifies the offset address of the beginning of the region of the value to be read. `max' specifies the max size to be read. If it is negative, the size to read is unlimited. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. If successful, the return value is the pointer to the region of the value of the corresponding large object, else, it is `NULL'. `NULL' is returned when no large object corresponds to the specified key or the size of the value of the corresponding large object is less than `start'. 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 if it is no longer in use..PPThe function `crvsizlob' is used in order to get the size of the value of a large object..TP.B int crvsizlob(CURIA *curia, const char *kbuf, int ksiz);`curia' specifies a database handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. If successful, the return value is the size of the value of the corresponding large object, else, it is \-1. Because this function does not read the entity of a large object, it is faster than `crgetlob'..PPThe function `crrnumlob' is used in order to get the number of the large objects stored in a database..TP.B int crrnumlob(CURIA *curia);`curia' specifies a database handle. If successful, the return value is the number of the large objects stored in the database, else, it is \-1..PPThough each function of Curia is not reentrant, it does not use any static object internally. So, it can be used as a thread\-safe function if each calling and reference to the external variable `dpecode' are under exclusion control, on the assumption that `errno', `malloc', and so on are thread\-safe..SH SEE ALSO.PP.BR qdbm (3),.BR depot (3),.BR relic (3),.BR hovel (3),.BR cabin (3),.BR villa (3),.BR odeum (3),.BR ndbm (3),.BR gdbm (3)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -