Refactor test_database
Improve prepare_command_record: it accepts any key
Refactor test_database more

Use prepare_command_record to simplify environ search
tests code shorter.
Document prepare_command_record
Add test_search_command_sort_by_success_count
Add test_search_command_sort_by_success_ratio (failing)
Fix --sort-by=success_ratio
Merge branch 'prepare_command_record'

test_database.TestInMemoryDataBase.prepare_command_record was added
to simplify tests.  Using this function, tests for success_count
and success_ratio are added.  A bug with --sort-by=success_ratio was
found and fixed.
Document SQLConstructor