On Sunday, 29 September 2013 at 15:42:10 UTC, simendsjo wrote:
I don't think it's that simple in this case. When I implement lazy fetching, both methods have it's advantages and disadvantages. MySQL doesn't allow multiplexing on a connection. This means a command must complete before issuing another. If reading rows lazily and then issuing a new command, the choice is to either disallow the new command, or invalidate the previous. The simple way would be to just start a new command and invalidate the previous, but is this the best way? If we choose to disallow new commands, that means the user have to explicitly close a lazy command. If using classes, we can safely have several instances for a command (is this neccessary?), but then the destructor wont't be a safe bet, and the user have to call close.
If implemented as a struct, we have to disallow copying.

So... I really don't know what the best design would be.

I reckon go with Command being a class and invalidate previous lazy loading on new commands being issued, you are after all issuing a *new* command. If multiplexing is needed a new connection can be made.

Reply via email to