1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355
|
.TH "TCBDB" 3 "2011-02-12" "Man Page" "Tokyo Cabinet"
.SH NAME
tcbdb \- the B+ tree database API
.SH DESCRIPTION
.PP
B+ tree database is a file containing a B+ tree and is handled with the B+ tree database API.
.PP
To use the B+ tree database API, include `\fBtcutil.h\fR', `\fBtcbdb.h\fR', and related standard header files. Usually, write the following description near the front of a source file.
.PP
.RS
.br
\fB#include <tcutil.h>\fR
.br
\fB#include <tcbdb.h>\fR
.br
\fB#include <stdlib.h>\fR
.br
\fB#include <time.h>\fR
.br
\fB#include <stdbool.h>\fR
.br
\fB#include <stdint.h>\fR
.RE
.PP
Objects whose type is pointer to `\fBTCBDB\fR' are used to handle B+ tree databases. A B+ tree database object is created with the function `\fBtcbdbnew\fR' and is deleted with the function `\fBtcbdbdel\fR'. To avoid memory leak, it is important to delete every object when it is no longer in use.
.PP
Before operations to store or retrieve records, it is necessary to open a database file and connect the B+ tree database object to it. The function `\fBtcbdbopen\fR' is used to open a database file and the function `\fBtcbdbclose\fR' is used to close the database file. To avoid data missing or corruption, it is important to close every database file when it is no longer in use. It is forbidden for multible database objects in a process to open the same database at the same time.
.SH API
.PP
The function `tcbdberrmsg' is used in order to get the message string corresponding to an error code.
.PP
.RS
.br
\fBconst char *tcbdberrmsg(int \fIecode\fB);\fR
.RS
`\fIecode\fR' specifies the error code.
.RE
.RS
The return value is the message string of the error code.
.RE
.RE
.PP
The function `tcbdbnew' is used in order to create a B+ tree database object.
.PP
.RS
.br
\fBTCBDB *tcbdbnew(void);\fR
.RS
The return value is the new B+ tree database object.
.RE
.RE
.PP
The function `tcbdbdel' is used in order to delete a B+ tree database object.
.PP
.RS
.br
\fBvoid tcbdbdel(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
If the database is not closed, it is closed implicitly. Note that the deleted object and its derivatives can not be used anymore.
.RE
.RE
.PP
The function `tcbdbecode' is used in order to get the last happened error code of a B+ tree database object.
.PP
.RS
.br
\fBint tcbdbecode(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
The return value is the last happened error code.
.RE
.RS
The following error codes are defined: `TCESUCCESS' for success, `TCETHREAD' for threading error, `TCEINVALID' for invalid operation, `TCENOFILE' for file not found, `TCENOPERM' for no permission, `TCEMETA' for invalid meta data, `TCERHEAD' for invalid record header, `TCEOPEN' for open error, `TCECLOSE' for close error, `TCETRUNC' for trunc error, `TCESYNC' for sync error, `TCESTAT' for stat error, `TCESEEK' for seek error, `TCEREAD' for read error, `TCEWRITE' for write error, `TCEMMAP' for mmap error, `TCELOCK' for lock error, `TCEUNLINK' for unlink error, `TCERENAME' for rename error, `TCEMKDIR' for mkdir error, `TCERMDIR' for rmdir error, `TCEKEEP' for existing record, `TCENOREC' for no record found, and `TCEMISC' for miscellaneous error.
.RE
.RE
.PP
The function `tcbdbsetmutex' is used in order to set mutual exclusion control of a B+ tree database object for threading.
.PP
.RS
.br
\fBbool tcbdbsetmutex(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Note that the mutual exclusion control of the database should be set before the database is opened.
.RE
.RE
.PP
The function `tcbdbsetcmpfunc' is used in order to set the custom comparison function of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbsetcmpfunc(TCBDB *\fIbdb\fB, TCCMP \fIcmp\fB, void *\fIcmpop\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
`\fIcmp\fR' specifies the pointer to the custom comparison function. It receives five parameters. The first parameter is the pointer to the region of one key. The second parameter is the size of the region of one key. The third parameter is the pointer to the region of the other key. The fourth parameter is the size of the region of the other key. The fifth parameter is the pointer to the optional opaque object. It returns positive if the former is big, negative if the latter is big, 0 if both are equivalent.
.RE
.RS
`\fIcmpop\fR' specifies an arbitrary pointer to be given as a parameter of the comparison function. If it is not needed, `NULL' can be specified.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
The default comparison function compares keys of two records by lexical order. The functions `tccmplexical' (default), `tccmpdecimal', `tccmpint32', and `tccmpint64' are built\-in. Note that the comparison function should be set before the database is opened. Moreover, user\-defined comparison functions should be set every time the database is being opened.
.RE
.RE
.PP
The function `tcbdbtune' is used in order to set the tuning parameters of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbtune(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 which is not opened.
.RE
.RS
`\fIlmemb\fR' specifies the number of members in each leaf page. If it is not more than 0, the default value is specified. The default value is 128.
.RE
.RS
`\fInmemb\fR' specifies the number of members in each non\-leaf page. If it is not more than 0, the default value is specified. The default value is 256.
.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 16381. Suggested size of the bucket array is about from 1 to 4 times of the number of all pages to be stored.
.RE
.RS
`\fIapow\fR' specifies the size of record alignment by power of 2. If it is negative, the default value is specified. The default value is 8 standing for 2^8=256.
.RE
.RS
`\fIfpow\fR' specifies the maximum number of elements of the free block pool by power of 2. If it is negative, the default value is specified. The default value is 10 standing for 2^10=1024.
.RE
.RS
`\fIopts\fR' specifies options by bitwise-or: `BDBTLARGE' specifies that the size of the database can be larger than 2GB by using 64\-bit bucket array, `BDBTDEFLATE' specifies that each page is compressed with Deflate encoding, `BDBTBZIP' specifies that each page is compressed with BZIP2 encoding, `BDBTTCBS' specifies that each page is compressed with TCBS encoding.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Note that the tuning parameters should be set before the database is opened.
.RE
.RE
.PP
The function `tcbdbsetcache' is used in order to set the caching parameters of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbsetcache(TCBDB *\fIbdb\fB, int32_t \fIlcnum\fB, int32_t \fIncnum\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
`\fIlcnum\fR' 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 1024.
.RE
.RS
`\fIncnum\fR' 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.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Note that the caching parameters should be set before the database is opened.
.RE
.RE
.PP
The function `tcbdbsetxmsiz' is used in order to set the size of the extra mapped memory of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbsetxmsiz(TCBDB *\fIbdb\fB, int64_t \fIxmsiz\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
`\fIxmsiz\fR' specifies the size of the extra mapped memory. If it is not more than 0, the extra mapped memory is disabled. It is disabled by default.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Note that the mapping parameters should be set before the database is opened.
.RE
.RE
.PP
The function `tcbdbsetdfunit' is used in order to set the unit step number of auto defragmentation of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbsetdfunit(TCBDB *\fIbdb\fB, int32_t \fIdfunit\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
`\fIdfunit\fR' specifie the unit step number. If it is not more than 0, the auto defragmentation is disabled. It is disabled by default.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Note that the defragmentation parameter should be set before the database is opened.
.RE
.RE
.PP
The function `tcbdbopen' is used in order to open a database file and connect a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbopen(TCBDB *\fIbdb\fB, const char *\fIpath\fB, int \fIomode\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object which is not opened.
.RE
.RS
`\fIpath\fR' specifies the path of the database file.
.RE
.RS
`\fIomode\fR' specifies the connection mode: `BDBOWRITER' as a writer, `BDBOREADER' as a reader. If the mode is `BDBOWRITER', the following may be added by bitwise-or: `BDBOCREAT', which means it creates a new database if not exist, `BDBOTRUNC', which means it creates a new database regardless if one exists, `BDBOTSYNC', which means every transaction synchronizes updated contents with the device. Both of `BDBOREADER' and `BDBOWRITER' can be added to by bitwise-or: `BDBONOLCK', which means it opens the database file without file locking, or `BDBOLCKNB', which means locking is performed without blocking.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RE
.PP
The function `tcbdbclose' is used in order to close a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbclose(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
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.
.RE
.RE
.PP
The function `tcbdbput' is used in order to store a record into a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbput(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\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
`\fIvbuf\fR' specifies the pointer to the region of the value.
.RE
.RS
`\fIvsiz\fR' specifies the size of the region of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, it is overwritten.
.RE
.RE
.PP
The function `tcbdbput2' is used in order to store a string record into a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbput2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB, const char *\fIvstr\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
.RS
`\fIvstr\fR' specifies the string of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, it is overwritten.
.RE
.RE
.PP
The function `tcbdbputkeep' is used in order to store a new record into a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbputkeep(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\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
`\fIvbuf\fR' specifies the pointer to the region of the value.
.RE
.RS
`\fIvsiz\fR' specifies the size of the region of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, this function has no effect.
.RE
.RE
.PP
The function `tcbdbputkeep2' is used in order to store a new string record into a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbputkeep2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB, const char *\fIvstr\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
.RS
`\fIvstr\fR' specifies the string of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, this function has no effect.
.RE
.RE
.PP
The function `tcbdbputcat' is used in order to concatenate a value at the end of the existing record in a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbputcat(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\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
`\fIvbuf\fR' specifies the pointer to the region of the value.
.RE
.RS
`\fIvsiz\fR' specifies the size of the region of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If there is no corresponding record, a new record is created.
.RE
.RE
.PP
The function `tcbdbputcat2' is used in order to concatenate a string value at the end of the existing record in a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbputcat2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB, const char *\fIvstr\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
.RS
`\fIvstr\fR' specifies the string of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If there is no corresponding record, a new record is created.
.RE
.RE
.PP
The function `tcbdbputdup' is used in order to store a record into a B+ tree database object with allowing duplication of keys.
.PP
.RS
.br
\fBbool tcbdbputdup(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\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
`\fIvbuf\fR' specifies the pointer to the region of the value.
.RE
.RS
`\fIvsiz\fR' specifies the size of the region of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, the new record is placed after the existing one.
.RE
.RE
.PP
The function `tcbdbputdup2' is used in order to store a string record into a B+ tree database object with allowing duplication of keys.
.PP
.RS
.br
\fBbool tcbdbputdup2(TCBDB *\fIbdb\fB, const char *\fIkstr\fB, const char *\fIvstr\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
.RS
`\fIvstr\fR' specifies the string of the value.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, the new record is placed after the existing one.
.RE
.RE
.PP
The function `tcbdbputdup3' is used in order to store records into a B+ tree database object with allowing duplication of keys.
.PP
.RS
.br
\fBbool tcbdbputdup3(TCBDB *\fIbdb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const TCLIST *\fIvals\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 common key.
.RE
.RS
`\fIksiz\fR' specifies the size of the region of the common key.
.RE
.RS
`\fIvals\fR' specifies a list object containing values.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If a record with the same key exists in the database, the new records are placed after the existing one.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If the key of duplicated records is specified, the first one is selected.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If the key of duplicated records is specified, the first one is selected.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
If the key of duplicated records is specified, all of them are removed.
.RE
.RE
.PP
The 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
.RS
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.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the string of the value of the corresponding record. `NULL' is returned if no record corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
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.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is a list object of the values of the corresponding records. `NULL' is returned if no record corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the number of the corresponding records, else, it is 0.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the number of the corresponding records, else, it is 0.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
.RE
.RS
If the key of duplicated records is specified, the first one is selected.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
.RE
.RS
If the key of duplicated records is specified, the first one is selected.
.RE
.RE
.PP
The 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
.RS
The return value is a list object of the keys of the corresponding records. This function does never fail. It returns an empty list even if no record corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
The return value is a list object of the keys of the corresponding records. This function does never fail. It returns an empty list even if no record corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the summation value, else, it is `INT_MIN'.
.RE
.RS
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.
.RE
.RE
.PP
The 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
.RS
If successful, the return value is the summation value, else, it is Not-a-Number.
.RE
.RS
If 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
.PP
The 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
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
This function is useful when another process connects to the same database file.
.RE
.RE
.PP
The 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
`\fIopts\fR' specifies options by bitwise-or: `BDBTLARGE' specifies that the size of the database can be larger than 2GB by using 64\-bit bucket array, `BDBTDEFLATE' specifies that each record is compressed with Deflate encoding, `BDBTBZIP' specifies that each page is compressed with BZIP2 encoding, `BDBTTCBS' specifies that each page is compressed with TCBS encoding. If it is `UINT8_MAX', the current setting is not changed.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
This function is useful to reduce the size of the database file with data fragmentation by successive updating.
.RE
.RE
.PP
The function `tcbdbvanish' is used in order to remove all records of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbvanish(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object connected as a writer.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RE
.PP
The function `tcbdbcopy' is used in order to copy the database file of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbcopy(TCBDB *\fIbdb\fB, const char *\fIpath\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
`\fIpath\fR' specifies the path of the destination file. If it begins with `@', the trailing substring is executed as a command line.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if the executed command returns non\-zero code.
.RE
.RS
The database file is assured to be kept synchronized and not modified while the copying or executing operation is in progress. So, this function is useful to create a backup file of the database file.
.RE
.RE
.PP
The function `tcbdbtranbegin' is used in order to begin the transaction of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbtranbegin(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object connected as a writer.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
The database is locked by the thread while the transaction so that only one transaction can be activated with a database object at the same time. Thus, the serializable isolation level is assumed if every database operation is performed in the transaction. Because all pages are cached on memory while the transaction, the amount of referred records is limited by the memory capacity. If the database is closed during transaction, the transaction is aborted implicitly.
.RE
.RE
.PP
The function `tcbdbtrancommit' is used in order to commit the transaction of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbtrancommit(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object connected as a writer.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Update in the transaction is fixed when it is committed successfully.
.RE
.RE
.PP
The function `tcbdbtranabort' is used in order to abort the transaction of a B+ tree database object.
.PP
.RS
.br
\fBbool tcbdbtranabort(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object connected as a writer.
.RE
.RS
If successful, the return value is true, else, it is false.
.RE
.RS
Update in the transaction is discarded when it is aborted. The state of the database is rollbacked to before transaction.
.RE
.RE
.PP
The function `tcbdbpath' is used in order to get the file path of a B+ tree database object.
.PP
.RS
.br
\fBconst char *tcbdbpath(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
The return value is the path of the database file or `NULL' if the object does not connect to any database file.
.RE
.RE
.PP
The function `tcbdbrnum' is used in order to get the number of records of a B+ tree database object.
.PP
.RS
.br
\fBuint64_t tcbdbrnum(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
The return value is the number of records or 0 if the object does not connect to any database file.
.RE
.RE
.PP
The function `tcbdbfsiz' is used in order to get the size of the database file of a B+ tree database object.
.PP
.RS
.br
\fBuint64_t tcbdbfsiz(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
The return value is the size of the database file or 0 if the object does not connect to any database file.
.RE
.RE
.PP
The function `tcbdbcurnew' is used in order to create a cursor object.
.PP
.RS
.br
\fBBDBCUR *tcbdbcurnew(TCBDB *\fIbdb\fB);\fR
.RS
`\fIbdb\fR' specifies the B+ tree database object.
.RE
.RS
The return value is the new cursor object.
.RE
.RS
Note that the cursor is available only after initialization with the `tcbdbcurfirst' or the `tcbdbcurjump' functions and so on. Moreover, the position of the cursor will be indefinite when the database is updated after the initialization of the cursor.
.RE
.RE
.PP
The function `tcbdbcurdel' is used in order to delete a cursor object.
.PP
.RS
.br
\fBvoid tcbdbcurdel(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RE
.PP
The function `tcbdbcurfirst' is used in order to move a cursor object to the first record.
.PP
.RS
.br
\fBbool tcbdbcurfirst(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if there is no record in the database.
.RE
.RE
.PP
The function `tcbdbcurlast' is used in order to move a cursor object to the last record.
.PP
.RS
.br
\fBbool tcbdbcurlast(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if there is no record in the database.
.RE
.RE
.PP
The function `tcbdbcurjump' is used in order to move a cursor object to the front of records corresponding a key.
.PP
.RS
.br
\fBbool tcbdbcurjump(BDBCUR *\fIcur\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
.RS
`\fIcur\fR' specifies the cursor 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
If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition.
.RE
.RS
The cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist.
.RE
.RE
.PP
The function `tcbdbcurjump2' is used in order to move a cursor object to the front of records corresponding a key string.
.PP
.RS
.br
\fBbool tcbdbcurjump2(BDBCUR *\fIcur\fB, const char *\fIkstr\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIkstr\fR' specifies the string of the key.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if there is no record corresponding the condition.
.RE
.RS
The cursor is set to the first record corresponding the key or the next substitute if completely matching record does not exist.
.RE
.RE
.PP
The function `tcbdbcurprev' is used in order to move a cursor object to the previous record.
.PP
.RS
.br
\fBbool tcbdbcurprev(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if there is no previous record.
.RE
.RE
.PP
The function `tcbdbcurnext' is used in order to move a cursor object to the next record.
.PP
.RS
.br
\fBbool tcbdbcurnext(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned if there is no next record.
.RE
.RE
.PP
The function `tcbdbcurput' is used in order to insert a record around a cursor object.
.PP
.RS
.br
\fBbool tcbdbcurput(BDBCUR *\fIcur\fB, const void *\fIvbuf\fB, int \fIvsiz\fB, int \fIcpmode\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object of writer connection.
.RE
.RS
`\fIvbuf\fR' specifies the pointer to the region of the value.
.RE
.RS
`\fIvsiz\fR' specifies the size of the region of the value.
.RE
.RS
`\fIcpmode\fR' specifies detail adjustment: `BDBCPCURRENT', which means that the value of the current record is overwritten, `BDBCPBEFORE', which means that the new record is inserted before the current record, `BDBCPAFTER', which means that the new record is inserted after the current record.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position.
.RE
.RS
After insertion, the cursor is moved to the inserted record.
.RE
.RE
.PP
The function `tcbdbcurput2' is used in order to insert a string record around a cursor object.
.PP
.RS
.br
\fBbool tcbdbcurput2(BDBCUR *\fIcur\fB, const char *\fIvstr\fB, int \fIcpmode\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object of writer connection.
.RE
.RS
`\fIvstr\fR' specifies the string of the value.
.RE
.RS
`\fIcpmode\fR' specifies detail adjustment: `BDBCPCURRENT', which means that the value of the current record is overwritten, `BDBCPBEFORE', which means that the new record is inserted before the current record, `BDBCPAFTER', which means that the new record is inserted after the current record.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position.
.RE
.RS
After insertion, the cursor is moved to the inserted record.
.RE
.RE
.PP
The function `tcbdbcurout' is used in order to remove the record where a cursor object is.
.PP
.RS
.br
\fBbool tcbdbcurout(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object of writer connection.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position.
.RE
.RS
After deletion, the cursor is moved to the next record if possible.
.RE
.RE
.PP
The function `tcbdbcurkey' is used in order to get the key of the record where the cursor object is.
.PP
.RS
.br
\fBchar *tcbdbcurkey(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
.RE
.RS
If successful, the return value is the pointer to the region of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurkey2' is used in order to get the key string of the record where the cursor object is.
.PP
.RS
.br
\fBchar *tcbdbcurkey2(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is the string of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurkey3' is used in order to get the key of the record where the cursor object is, as a volatile buffer.
.PP
.RS
.br
\fBconst char *tcbdbcurkey3(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
.RE
.RS
If successful, the return value is the pointer to the region of the key, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurval' is used in order to get the value of the record where the cursor object is.
.PP
.RS
.br
\fBchar *tcbdbcurval(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
.RE
.RS
If successful, the return value is the pointer to the region of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurval2' is used in order to get the value string of the record where the cursor object is.
.PP
.RS
.br
\fBchar *tcbdbcurval2(BDBCUR *\fIcur\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
If successful, the return value is the string of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurval3' is used in order to get the value of the record where the cursor object is, as a volatile buffer.
.PP
.RS
.br
\fBconst char *tcbdbcurval3(BDBCUR *\fIcur\fB, int *\fIsp\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
.RE
.RS
If successful, the return value is the pointer to the region of the value, else, it is `NULL'. `NULL' is returned when the cursor is at invalid position.
.RE
.RS
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
.PP
The function `tcbdbcurrec' is used in order to get the key and the value of the record where the cursor object is.
.PP
.RS
.br
\fBbool tcbdbcurrec(BDBCUR *\fIcur\fB, TCXSTR *\fIkxstr\fB, TCXSTR *\fIvxstr\fB);\fR
.RS
`\fIcur\fR' specifies the cursor object.
.RE
.RS
`\fIkxstr\fR' specifies the object into which the key is wrote down.
.RE
.RS
`\fIvxstr\fR' specifies the object into which the value is wrote down.
.RE
.RS
If successful, the return value is true, else, it is false. False is returned when the cursor is at invalid position.
.RE
.RE
.SH SEE ALSO
.PP
.BR tcbtest (1),
.BR tcbmttest (1),
.BR tcbmgr (1),
.BR tokyocabinet (3)
|