File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ Thick Mode Changes
2525
2626#) Fixed bug creating a homogeneous connection pool with a proxy user
2727 (`issue 101 <https://github.com/oracle/python-oracledb/issues/101 >`__).
28+ #) Fixed bug closing a SODA document cursor explicitly (instead of simply
29+ allowing it to be closed automatically when it goes out of scope).
2830
2931Common Changes
3032++++++++++++++
Original file line number Diff line number Diff line change @@ -570,6 +570,16 @@ cdef class ThickSodaDocCursorImpl(BaseSodaDocCursorImpl):
570570 if self ._handle != NULL :
571571 dpiSodaDocCursor_release(self ._handle)
572572
573+ def close (self ):
574+ """
575+ Internal method for closing the cursor.
576+ """
577+ cdef int status
578+ with nogil:
579+ status = dpiSodaDocCursor_close(self ._handle)
580+ if status < 0 :
581+ _raise_from_odpi()
582+
573583 def get_next_doc (self ):
574584 """
575585 Internal method for getting the next document from the cursor.
Original file line number Diff line number Diff line change 3232from typing import Union , List
3333import json
3434
35- from . import connection
35+ from . import connection , errors
3636
3737class SodaDatabase :
3838
@@ -421,6 +421,8 @@ def __iter__(self):
421421 return self
422422
423423 def __next__ (self ):
424+ if self ._impl is None :
425+ errors ._raise_err (errors .ERR_CURSOR_NOT_OPEN )
424426 doc_impl = self ._impl .get_next_doc ()
425427 if doc_impl is not None :
426428 return SodaDocument ._from_impl (doc_impl )
@@ -438,7 +440,10 @@ def close(self) -> None:
438440 cursor will be unusable from this point forward; an Error exception
439441 will be raised if any operation is attempted with the cursor.
440442 """
443+ if self ._impl is None :
444+ errors ._raise_err (errors .ERR_CURSOR_NOT_OPEN )
441445 self ._impl .close ()
446+ self ._impl = None
442447
443448
444449class SodaOperation :
You can’t perform that action at this time.
0 commit comments