´btree´
default database name.
Btree database maintenance tool.
btreeop [-A]
[-C]
[-D
[n]
key]
[-K
[n]
key]
[-L
[2]]
[-k
prefix]
[dbname]
Btreeop execute simple operations for btree(3) database. Btreeop can create database, write record, read record (sequential or indexed) and delete record from it. Duplicate entries are allowed. Multi-key is available but only primary key can use index of btree(3).
A capital letter means a command. If no command specified then it assume sequential read operation. The following commands are available:
Read records sequentially.
-A
Append records. If database doesn't exist, btreeop creates it.
-C
Create database and write records to it.
|
Delete records by the key. By default, n is 0 (primary key). |
|---|---|
|
Search records by the key. By default, n is 0 (primary key). |
-L[2]
List all primary keys. If 2 is specified, list all the key and data pairs.
Database name. By default, it assume ´btree´.
-k prefix
Scan records which have the prefix as a primary key. This option is valid only with sequential read operation -L command or no command.
To creat (or append) database, btreeop read data from stdin. The format of the data is the following.
Primary-key Secondary-key-1 Secondary-key-2 Data
(keyno = 0) (keyno = 1) (keyno = 2)
--------------------------------------------------------------
main 246 main.c main () {
func 120 library.c func(a1, a2)
.
.
.
o All key and data are separated by blank('\t' or ' '). o Key cannot include blank. o Data can include blank. o Null data not allowed.
Additionally, META record is available. META record has a key that start with a blank. You can read this record only by indexed read operation (-K option). Usage is unlimited by btreeop.
Create database.
% btreeop -C
key1 data1
key2 data2
key3 data3
^D
%
Append records.
% btreeop -A
__.VERSION 2
key2 data2-2
^D
%
Sequential read.
% btreeop
key1 data1
key2 data2-2
key2 data2
key3 data3
%
Indexed read.
% btreeop -K key2
key2 data2-2
key2 data2
% btreeop -K ' __.VERSION'
__.VERSION 2
%
List primary keys.
% btreeop -L
key1
key2
key3
%
Delete record.
% btreeop -D ' __.VERSION'
% btreeop -K ' __.VERSION'
%
´btree´
default database name.
Btreeop exits with a non 0 value if an error occurred, 0 otherwise.
3 releases since Debian 2.2 (Potato); the text changed 2 times.