-
Notifications
You must be signed in to change notification settings - Fork 3
CLI Revori Client
dougborg edited this page Jan 3, 2013
·
1 revision
In addition to the Java API, there is an SQL-style server and command line client for interactive access to Revori databases. This can be useful for querying the state of a running system and modifying it if necessary.
The server understands a useful subset of SQL, as well as extensions to support tagging, diffing, and merging database revisions. To start the server, run e.g.:
java -cp build/revori.jar com.readytalk.revori.server.SQLServer 0.0.0.0 8018 To start the client, run
./build/client localhost 8018 Here's an example of how to use it:
Welcome to the Revori SQL client interface. Type "help" to get started.
> create database zoo
created database zoo
> use database zoo
switched to database zoo
zoo > create table animals(name string, sound string, class string, primary key(name))
table animals defined
zoo > insert into animals values('Alligator', 'snap', 'reptilia')
inserted 1 row
zoo > insert into animals values('Rabbit', 'nibble', 'mammalia')
inserted 1 row
zoo > insert into animals values('Snake', 'hiss', 'reptilia')
inserted 1 row
zoo > insert into animals values('Bear', 'growl', 'mammalia')
inserted 1 row
zoo > insert into animals values('Shark', 'dun dun ... dun dun ...', 'chondrichthyes')
inserted 1 row
zoo > insert into animals values('Spider', '<silence>', 'arachnida')
inserted 1 row
zoo > insert into animals values('Tiger', 'roar', 'mammalia')
inserted 1 row
zoo > insert into animals values('Lion', 'roar', 'mammalia')
inserted 1 row
zoo > insert into animals values('Pig', 'oink', 'mammalia')
inserted 1 row
zoo > insert into animals values('Kangaroo', 'boing', 'mammalia')
inserted 1 row
zoo > insert into animals values('Horse', 'neigh', 'mammalia')
inserted 1 row
zoo > insert into animals values('Wolf', 'growl', 'mammalia')
inserted 1 row
zoo > insert into animals values('Squirrel', 'chitter', 'mammalia')
inserted 1 row
zoo > create table classes(class_name string, description string, primary key(class_name))
table classes defined
zoo > insert into classes values('mammalia', 'Animals with internal skeletons, mammaries, etc.')
inserted 1 row
zoo > insert into classes values('reptilia', 'Cold-blooded animals, often seen with scales')
inserted 1 row
zoo > insert into classes values('arachnida', 'Arachnids. nuf said.')
inserted 1 row
zoo > insert into classes values('chondrichthyes', 'Fish with skeletons made of cartilage. The stuff of JAWS')
inserted 1 row
zoo > tag original head
tag original set to head
zoo > select * from animals
inserted: Alligator snap reptilia
inserted: Bear growl mammalia
inserted: Horse neigh mammalia
inserted: Kangaroo boing mammalia
inserted: Lion roar mammalia
inserted: Pig oink mammalia
inserted: Rabbit nibble mammalia
inserted: Shark dun dun ... dun dun ... chondrichthyes
inserted: Snake hiss reptilia
inserted: Spider <silence> arachnida
inserted: Squirrel chitter mammalia
inserted: Tiger roar mammalia
inserted: Wolf growl mammalia
zoo > select sound from animals where name='Lion'
inserted: roar
zoo > select name from animals where sound='roar'
inserted: Lion
inserted: Tiger
zoo > select name, description from animals inner join classes on class_name = class where class = 'reptilia'
inserted: Alligator Cold-blooded animals, often seen with scales
inserted: Snake Cold-blooded animals, often seen with scales
zoo > tag v1 head
tag v1 set to head
zoo > insert into animals values('Blue Whale', 'yyyywwwwwaaaaauuuuuunnnnnn', 'mammalia')
inserted 1 row
zoo > tag v2 head
tag v2 set to head
zoo > diff v1 v2 select * from animals
inserted: Blue Whale yyyywwwwwaaaaauuuuuunnnnnn mammalia
zoo > diff v2 v1 select * from animals
deleted: Blue Whale yyyywwwwwaaaaauuuuuunnnnnn mammalia
zoo > tag head v1
tag head set to v1
zoo > select * from animals
inserted: Alligator snap reptilia
inserted: Bear growl mammalia
inserted: Horse neigh mammalia
inserted: Kangaroo boing mammalia
inserted: Lion roar mammalia
inserted: Pig oink mammalia
inserted: Rabbit nibble mammalia
inserted: Shark dun dun ... dun dun ... chondrichthyes
inserted: Snake hiss reptilia
inserted: Spider <silence> arachnida
inserted: Squirrel chitter mammalia
inserted: Tiger roar mammalia
inserted: Wolf growl mammalia
zoo > insert into animals values('Germ', 'ick!', 'various')
inserted 1 row
zoo > tag v3 head
tag v3 set to head
zoo > diff v1 v3 select * from animals
inserted: Germ ick! various
zoo > merge v1 v2 v3
head set to result of merge (0 conflict(s))
zoo > select * from animals
inserted: Alligator snap reptilia
inserted: Bear growl mammalia
inserted: Blue Whale yyyywwwwwaaaaauuuuuunnnnnn mammalia
inserted: Germ ick! various
inserted: Horse neigh mammalia
inserted: Kangaroo boing mammalia
inserted: Lion roar mammalia
inserted: Pig oink mammalia
inserted: Rabbit nibble mammalia
inserted: Shark dun dun ... dun dun ... chondrichthyes
inserted: Snake hiss reptilia
inserted: Spider <silence> arachnida
inserted: Squirrel chitter mammalia
inserted: Tiger roar mammalia
inserted: Wolf growl mammalia
zoo > tag head v1
tag head set to v1
zoo > select * from animals
inserted: Alligator snap reptilia
inserted: Bear growl mammalia
inserted: Horse neigh mammalia
inserted: Kangaroo boing mammalia
inserted: Lion roar mammalia
inserted: Pig oink mammalia
inserted: Rabbit nibble mammalia
inserted: Shark dun dun ... dun dun ... chondrichthyes
inserted: Snake hiss reptilia
inserted: Spider <silence> arachnida
inserted: Squirrel chitter mammalia
inserted: Tiger roar mammalia
inserted: Wolf growl mammalia