Add assert against mixing cursor and regular DB calls.

Only active in debug mode.