Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion tests/bugs/gh_7057_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,26 @@ def test_1(act: Action, capsys):
con.commit()

cur = con.cursor()
cur.open('select id from ts')
cur.open('select id from ts for update')
cur.set_cursor_name('X')

for row in cur:
print_row(row)

# Check for error states:
# Cursor is not positioned on valid record
try:
con.execute_immediate('update ts set id = -id where current of X')
except Exception as err:
print(err)
# Cursor is closed
cur.close()
try:
con.execute_immediate('update ts set id = -id where current of X')
except Exception as err:
print(err)
con.commit()

act.stdout = capsys.readouterr().out
act.expected_stdout = """
1
Expand Down Expand Up @@ -148,5 +163,11 @@ def test_1(act: Action, capsys):
8
9
-10
Dynamic SQL Error
-Cursor X is not positioned in a valid record
Dynamic SQL Error
-SQL error code = -504
-Invalid cursor reference
-Cursor X is not found in the current context
"""
assert act.clean_stdout == act.clean_expected_stdout