Fixed #22879 -- Wrapped cursor iterator to intercept database errors coming from __next__ method.

...ethod.

This is needed for django-sqlserver driver.

Ticket #22879
I believe this way is also much more efficient. The \__next__ path causes two extra method calls, and one with statement to be executed for each call.