mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(odbc): add changelog fragment for PR #11972 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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).
|
||||
@@ -132,8 +132,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():
|
||||
@@ -158,6 +156,8 @@ def main():
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f"Exception while reading rows: {e}")
|
||||
|
||||
if commit:
|
||||
cursor.commit()
|
||||
cursor.close()
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f"Failed to execute query: {e}")
|
||||
|
||||
Reference in New Issue
Block a user