1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-06 18:15:54 +00:00

[PR #11972/d7f248fb backport][stable-11] odbc: fetch rows before commit to fix HY010 function sequence error (#11982)

odbc: fetch rows before commit to fix HY010 function sequence error (#11972)

* fix(odbc): fetch rows before committing to fix HY010 function sequence error

Fixes #5395



* chore(odbc): add changelog fragment for PR #11972



---------


(cherry picked from commit d7f248fb01)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
patchback[bot] 2026-05-03 12:07:18 +02:00 committed by GitHub
parent d4324999da
commit b2a1249412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- odbc - fetch rows before committing to fix ``HY010`` function sequence error (https://github.com/ansible-collections/community.general/issues/5395, https://github.com/ansible-collections/community.general/pull/11972).

View file

@ -134,8 +134,6 @@ def main():
cursor.execute(query, params)
else:
cursor.execute(query)
if commit:
cursor.commit()
try:
# Get the rows out into an 2d array
for row in cursor.fetchall():
@ -162,6 +160,8 @@ def main():
except Exception as e:
module.fail_json(msg="Exception while reading rows: {0}".format(to_native(e)))
if commit:
cursor.commit()
cursor.close()
except Exception as e:
module.fail_json(msg="Failed to execute query: {0}".format(to_native(e)))