newdb: Handle databases with case duplicates

databases created with pre 1.0 versions of calibre could have multiple
tags/series/publishers/etc. that differ only in the case. This is
because sqlite's case handling only works for ascii characters.
This could cause problems when setting metadata.
Automatically detect and fix these databases. Fixes #1221545 [edit metadata individually>Download Metadata>press ok>unhandled exception](https://bugs.launchpad.net/calibre/+bug/1221545)