Sometimes its not possible to use client side cursors
because the memory hit is too big when copying the
result set into the client. Using SS cursors is also
not appropriate because the client may not want all the
results anyway (i.e. might read a couple of rows then
lose the context).
We need a cursor class which does something in between.
Copy result sets to the client up to a maximum number
of rows. When those are consumed, grab the next lot
from the server etc. This achieves a balance between
client memory consumption and network traffic.
We need to trap "mysql commands out of sequence" errors
to transparently hide a reconnection if the SS
connection has not been fully drained.
See for example:
This would be nice if it was already built in because
it would prevent the memory hit that client side has,
but make using SS more friendly.