-
Notifications
You must be signed in to change notification settings - Fork 130
Open
Labels
Description
I have a couple suggestions for libmdbx's CLI front-ends, inspired by functionality provided by Berkeley DB or other DBM-type databases:
- making it possible to pass configuration options, such as the page size, to
mdbx_load- effectively an equivalent to Berkeley DB'sdb_load -c .... Maybemdbx_copybetween different database files could benefit from that as well. - in order to provide CLI scriptability (and indirectly better fuzzing support) without having to use one of the language bindings for libmdbx, creating a generic
mdbxtoolfront-end, similar to TDB'stdbtooland GDBM'sgdbmtool, with the ability to read arguments from stdin, from a file, from command-line arguments, or interactively.
FWIW, I sent the suggestion of creating similar tools to both Oracle for BDB and Howard Chu for LMDB, and years ago, Sergey Poznyakoff improved gdbmtool to follow tdbtool's lead.
$ gdbmtool
Welcome to the gdbm tool. Type ? for help.
gdbmtool> ?
avail print avail list
bucket NUMBER print a bucket
cache print the bucket cache
close close the database
count count (number of entries)
current print current bucket
debug query/set debug level
define key|content { FIELD-LIST } define datum structure
delete KEY delete a record
dir print hash directory
export FILE [truncate] [binary|ascii] export
fetch KEY fetch record
first firstkey
hash KEY hash value of key
header print database file header
help print this help list
history [FROM] [COUNT] show input history
import FILE [replace] [nometa] import
list list
next [KEY] nextkey
open FILE open new database
quit quit the program
recover [verbose] [summary] [backup] [force] [max-failed-keys=N] [max-failed-buckets=N] [max-failures=N] recover the database
reorganize reorganize
set [VAR=VALUE...] set or list variables
source FILE source command script
status print current program status
store KEY DATA store
unset VAR... unset variables
version print version of gdbm
gdbmtool>
$ tdbtool
tdb> ?
database not open
tdbtool:
create dbname : create a database
open dbname : open an existing database
transaction_start : start a transaction
transaction_commit : commit a transaction
transaction_cancel : cancel a transaction
erase : erase the database
dump : dump the database as strings
keys : dump the database keys as strings
hexkeys : dump the database keys as hex values
info : print summary info about the database
insert key data : insert a record
move key file : move a record to a destination tdb
storehex key data : store a record (replace), key/value in hex format
store key data : store a record (replace)
show key : show a record by key
delete key : delete a record by key
list : print the database hash table and freelist
free : print the database freelist
freelist_size : print the number of records in the freelist
check : check the integrity of an opened database
repack : repack the database
speed : perform speed tests on the database
! command : execute system command
1 | first : print the first record
n | next : print the next record
q | quit : terminate
\n : repeat 'next' command
tdb>
erthink