Code: Select all
#!/bin/ash
#+-{ALL_DBS}
# +-{DB}
# +-{table}
# +-0 set -- COL1 COL2 ... #header
# +-1 COL1="" COL2="" ... #more records follow
# +-transactions #used to undo
ALL_DBS="$HOME/.SHBASE"
DB="${ALL_DBS}/${1:-default}"
[ -d "$TABLE" ] && mkdir -p "$TABLE"
create_table(){
mkdir -p "$ALL_DBS/$DB"
}
drop_table(){
echo will hide the associated table by renaming to ".$table_name"
echo this transaction will be recorded for undoing
}
delete_table(){
echo will actually delete the table
echo this is not a recorded transaction since it cannot be undone
}
insert_into(){
echo will record transaction and add the new record
}
resync_db(){
echo rewrites all records to remove superceded transactions
echo also reinitializes transaction table when complete
echo this will speed up new transactions at the cost of lost history
echo it can also reduce the size of the DB to possibly fit in inodes
}
select(){
echo will return the fields that match
}
undo_transaction(){
echo this will eventually revert transaction $1
}
undo_transactions_since(){
echo this will eventually revert all transactions since transaction $1
}
update(){
echo transaction, then fields
}
usage(){
echo $0 database action ...
}
where(){
echo will return all fields where all $@ matches
}