[TableResult] refactor to use TableResult type

Also, (length allDocs) queries were replaced by proper count queries
from the DB which is more efficient, except for the table query (this is
a bit more complex).
Status Job ID Name Coverage
  Build
failed #705
build1

 
Name Stage Failure
failed
build1 Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job trace