A query should be carried out as a prepare and a execute so that parameter encoding does not have to be done inside handle_query where an error will crash the connection. It also means adapters do not have to handle the prepare/encode/execute logic themselves.
However this leads to an issue where un-named queries won't be closed after a query without adding a round trip to explicitly close with handle_close. One way to solve this is to introduce a handle_execute_close and execute_close that allows an adapter to handle the execute and close in an efficient manor. The default implementation provided by __using__ would call handle_execute and handle_close.
A query should be carried out as a prepare and a execute so that parameter encoding does not have to be done inside
handle_query
where an error will crash the connection. It also means adapters do not have to handle the prepare/encode/execute logic themselves.However this leads to an issue where un-named queries won't be closed after a query without adding a round trip to explicitly close with
handle_close
. One way to solve this is to introduce ahandle_execute_close
andexecute_close
that allows an adapter to handle the execute and close in an efficient manor. The default implementation provided by__using__
would callhandle_execute
andhandle_close
.