Cache statements on param types as well as query

A parameter that's None needs a different PreparedStatement to a
parameter that's not None.