I've been using sqlite::memory:
for unit tests: it is quick, and makes test clean-up automatic. But I'm concerned my tests could be missing bugs due to SQL server assumptions. (This particular code is supposed to be DB-neutral, but pragmatically it must work with MySQL.)
As a specific example, I think date string inputs to sqlite get stored as strings (*), so they get given back to me in exactly the same format. Whereas in MySQL they appear to get parsed, normalized, and returned in a consistent format. My bigger concern is that there are differences I'm not so conscious of.
What is the best way to handle this? E.g. repeat all unit tests for mysql too (slow - is there a way to make an in-memory MySQL DB?). Just do mysql tests for some key areas of concern? Rely on functional tests that use MySQL (this is my current approach, but the coverage is much spottier). Something else I've not thought of?
*: If I give "2012-12-25 09:12:34" I get that exact string back. If I give "2012-12-25 09:12:34 UTC" I get back that exact string (i.e. with the timezone this time). If I give "2012-12-25 09:12:34 hello world" I get back "2012-12-25 09:12:34 hello world" :-(
In this particular case I'm using PHP, PDO and PHPUnit. I'm after language-independent strategies, but it is worth noting that PDO is a quite thin abstraction, more to do with abstracting the connection string and low-level API calls. It doesn't try to abstract data type differences between the databases.