⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tctdb.h

📁 Tokyo Cabinet的Tokyo Cabinet 是一个DBM的实现。这里的数据库由一系列key-value对的记录构成。key和value都可以是任意长度的字节序列,既可以是二进制也可以是字符
💻 H
📖 第 1 页 / 共 4 页
字号:
   record cache is disabled.  It is disabled by default.   `lcnum' specifies the maximum number of leaf nodes to be cached.  If it is not more than 0,   the default value is specified.  The default value is 4096.   `ncnum' specifies the maximum number of non-leaf nodes to be cached.  If it is not more than 0,   the default value is specified.  The default value is 512.   If successful, the return value is true, else, it is false.   Note that the caching parameters should be set before the database is opened.  Leaf nodes and   non-leaf nodes are used in column indices. */bool tctdbsetcache(TCTDB *tdb, int32_t rcnum, int32_t lcnum, int32_t ncnum);/* Set the size of the extra mapped memory of a table database object.   `tdb' specifies the table database object which is not opened.   `xmsiz' specifies the size of the extra mapped memory.  If it is not more than 0, the extra   mapped memory is disabled.  The default size is 67108864.   If successful, the return value is true, else, it is false.   Note that the mapping parameters should be set before the database is opened. */bool tctdbsetxmsiz(TCTDB *tdb, int64_t xmsiz);/* Open a database file and connect a table database object.   `tdb' specifies the table database object which is not opened.   `path' specifies the path of the database file.   `omode' specifies the connection mode: `TDBOWRITER' as a writer, `TDBOREADER' as a reader.   If the mode is `TDBOWRITER', the following may be added by bitwise-or: `TDBOCREAT', which   means it creates a new database if not exist, `TDBOTRUNC', which means it creates a new   database regardless if one exists, `TDBOTSYNC', which means every transaction synchronizes   updated contents with the device.  Both of `TDBOREADER' and `TDBOWRITER' can be added to by   bitwise-or: `TDBONOLCK', which means it opens the database file without file locking, or   `TDBOLCKNB', which means locking is performed without blocking.   If successful, the return value is true, else, it is false. */bool tctdbopen(TCTDB *tdb, const char *path, int omode);/* Close a table database object.   `tdb' specifies the table database object.   If successful, the return value is true, else, it is false.   Update of a database is assured to be written when the database is closed.  If a writer opens   a database but does not close it appropriately, the database will be broken. */bool tctdbclose(TCTDB *tdb);/* Store a record into a table database object.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cols' specifies a map object containing columns.   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 tctdbput(TCTDB *tdb, const void *pkbuf, int pksiz, TCMAP *cols);/* Store a string record into a table database object with a zero separated column string.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cbuf' specifies the pointer to the region of the zero separated column string where the name   and the value of each column are situated one after the other.   `csiz' specifies the size of the region of the column string.   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 tctdbput2(TCTDB *tdb, const void *pkbuf, int pksiz, const void *cbuf, int csiz);/* Store a string record into a table database object with a tab separated column string.   `tdb' specifies the table database object connected as a writer.   `pkstr' specifies the string of the primary key.   `cstr' specifies the string of the the tab separated column string where the name and the   value of each column are situated one after the other.   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 tctdbput3(TCTDB *tdb, const char *pkstr, const char *cstr);/* Store a new record into a table database object.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cols' specifies a map object containing columns.   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 tctdbputkeep(TCTDB *tdb, const void *pkbuf, int pksiz, TCMAP *cols);/* Store a new string record into a table database object with a zero separated column string.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cbuf' specifies the pointer to the region of the zero separated column string where the name   and the value of each column are situated one after the other.   `csiz' specifies the size of the region of the column string.   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 tctdbputkeep2(TCTDB *tdb, const void *pkbuf, int pksiz, const void *cbuf, int csiz);/* Store a new string record into a table database object with a tab separated column string.   `tdb' specifies the table database object connected as a writer.   `pkstr' specifies the string of the primary key.   `cstr' specifies the string of the the tab separated column string where the name and the   value of each column are situated one after the other.   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 tctdbputkeep3(TCTDB *tdb, const char *pkstr, const char *cstr);/* Concatenate columns of the existing record in a table database object.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cols' specifies a map object containing columns.   If successful, the return value is true, else, it is false.   If there is no corresponding record, a new record is created. */bool tctdbputcat(TCTDB *tdb, const void *pkbuf, int pksiz, TCMAP *cols);/* Concatenate columns in a table database object with a zero separated column string.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   `cbuf' specifies the pointer to the region of the zero separated column string where the name   and the value of each column are situated one after the other.   `csiz' specifies the size of the region of the column string.   If successful, the return value is true, else, it is false.   If there is no corresponding record, a new record is created. */bool tctdbputcat2(TCTDB *tdb, const void *pkbuf, int pksiz, const void *cbuf, int csiz);/* Concatenate columns in a table database object with with a tab separated column string.   `tdb' specifies the table database object connected as a writer.   `pkstr' specifies the string of the primary key.   `cstr' specifies the string of the the tab separated column string where the name and the   value of each column are situated one after the other.   If successful, the return value is true, else, it is false.   If there is no corresponding record, a new record is created. */bool tctdbputcat3(TCTDB *tdb, const char *pkstr, const char *cstr);/* Remove a record of a table database object.   `tdb' specifies the table database object connected as a writer.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   If successful, the return value is true, else, it is false. */bool tctdbout(TCTDB *tdb, const void *pkbuf, int pksiz);/* Remove a string record of a table database object.   `tdb' specifies the table database object connected as a writer.   `pkstr' specifies the string of the primary key.   If successful, the return value is true, else, it is false. */bool tctdbout2(TCTDB *tdb, const char *pkstr);/* Retrieve a record in a table database object.   `tdb' specifies the table database object.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary key.   If successful, the return value is a map object of the columns of the corresponding record.   `NULL' is returned if no record corresponds.   Because the object of the return value is created with the function `tcmapnew', it should be   deleted with the function `tcmapdel' when it is no longer in use. */TCMAP *tctdbget(TCTDB *tdb, const void *pkbuf, int pksiz);/* Retrieve a record in a table database object as a zero separated column string.   `tdb' specifies the table database object.   `pkbuf' specifies the pointer to the region of the primary key.   `pksiz' specifies the size of the region of the primary 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 column string 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 *tctdbget2(TCTDB *tdb, const void *pkbuf, int pksiz, int *sp);/* Retrieve a string record in a table database object as a tab separated column string.   `tdb' specifies the table database object.   `pkstr' specifies the string of the primary key.   If successful, the return value is the tab separated column string of the corresponding   record.  `NULL' is returned if no record corresponds.   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 *tctdbget3(TCTDB *tdb, const char *pkstr);/* Get the size of the value of a record in a table database object.   `tdb' specifies the table database object.   `kbuf' specifies the pointer to the region of the primary key.   `ksiz' specifies the size of the region of the primary key.   If successful, the return value is the size of the value of the corresponding record, else,   it is -1. */int tctdbvsiz(TCTDB *tdb, const void *pkbuf, int pksiz);/* Get the size of the value of a string record in a table database object.   `tdb' specifies the table database object.   `kstr' specifies the string of the primary key.   If successful, the return value is the size of the value of the corresponding record, else,   it is -1. */int tctdbvsiz2(TCTDB *tdb, const char *pkstr);/* Initialize the iterator of a table database object.   `tdb' specifies the table database object.   If successful, the return value is true, else, it is false.   The iterator is used in order to access the primary key of every record stored in a   database. */bool tctdbiterinit(TCTDB *tdb);/* Get the next primary key of the iterator of a table database object.   `tdb' specifies the table database 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 next primary 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 when it is no   longer in use.  It is possible to access every record by iteration of calling this function.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -