gh-94028: Clear and reset sqlite3 statements properly in cursor iternext (GH-94042)

(cherry picked from commit 94eeac03dc8c643ff050e7d0d306637d9556f798)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
3 files changed