Maybe using a concrete db adapter for which you know how it does escaping and do the assert based on that knowledge would do better?