If we have a prepared query struct with stale types, and we try execute that query with parameters for the new types the encode will fail without hitting the database. To handle this gracefully we should rescue DBConnection.EncodeErrorexceptions (or similarly unique exception) on encode calls to the query protocol. If it is an execute call we should go to prepare_execute to prepare a new version of the query and try to encode again. Similarly for declare/prepare_declare. For other functions we rescue EncodeError and return it in error tuple.
If we have a prepared query struct with stale types, and we try execute that query with parameters for the new types the encode will fail without hitting the database. To handle this gracefully we should rescue
DBConnection.EncodeError
exceptions (or similarly unique exception) on encode calls to the query protocol. If it is an execute call we should go to prepare_execute to prepare a new version of the query and try to encode again. Similarly for declare/prepare_declare. For other functions we rescue EncodeError and return it in error tuple.