Added simple apidb tests.

Previously, with the ruby/shell based tests we were testing the
full stack from fcgi through to the database. Now that the tests
are more properly separated and tested only from the routing
phase through to a mocked backend, we need further tests to check
the correct operation of the backends (and fcgi).

This adds a simple test which tests only the backend data
selection process. This means it's more fine-grained than previous
tests and should be able to pinpoint failures better.
Clarified return value meaning for multi-selects.

This threw up an error in the way that the read-only backend was
reporting the number of selected items, which is also fixed.
Fixes small things suggested by -Wall -Wextra.