sqljocky5 icon indicating copy to clipboard operation
sqljocky5 copied to clipboard

proposing a closeable prepare

Open u007 opened this issue 5 years ago • 6 comments
trafficstars

preparing a closable prepare to allow caller to close the prepared statement to avoid hitting mysql prepare statement limit example:

Prepared prepared = await adapter.prepare("select * from users where id=?");
Results result = await (await prepared.execute([5])).deStream();
if (result.length < 1) {
  prepared.deallocate();
  return null;
}
// parsing code...
logger.fine("mapped ${result.first}");
// more code here...
prepared.deallocate();

u007 avatar Dec 12 '19 10:12 u007

Is this doing what Prepared.deallocate was supported to do (but was never implemented)? That method's limited documentation says it "released the prepared statement", but its implementation in PreparedImpl just throws an UnimplementedError.

If so, either rename your method to deallocate, or keep your name and delete/deprecate the deallocate method. It doesn't help to have two methods whose names make them sound like they do the same thing and there is little documentation on either.

hoylen avatar Dec 12 '19 11:12 hoylen

done

u007 avatar Dec 13 '19 02:12 u007

Cool.

hoylen avatar Dec 13 '19 02:12 hoylen

Thanks for the PR.

Can we change the implementation so that Connection has deallocatePrepared method that PreparedStatement calls? Instead of passing socket and comm to PreparedStatement?

tejainece avatar Mar 02 '20 09:03 tejainece

hi any more issues?

u007 avatar May 24 '20 03:05 u007

its dead...

4stern avatar Dec 22 '20 15:12 4stern