Resolve db->getquery()->dump() bugs

Although this should work, JF reports that it doesn't.