Database: fixed tests & code for not-mysql databases