Refactor ::adapter_method

While reading #667 I found #adapter_method pretty hard to parse; this PR tries to make it somewhat more readable.
The method now also checks opts[:database] for non-string values.