File tree 3 files changed +18
-1
lines changed
3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ Thick Mode Changes
25
25
26
26
#) Fixed bug creating a homogeneous connection pool with a proxy user
27
27
(`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).
28
30
29
31
Common Changes
30
32
++++++++++++++
Original file line number Diff line number Diff line change @@ -570,6 +570,16 @@ cdef class ThickSodaDocCursorImpl(BaseSodaDocCursorImpl):
570
570
if self ._handle != NULL :
571
571
dpiSodaDocCursor_release(self ._handle)
572
572
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
+
573
583
def get_next_doc (self ):
574
584
"""
575
585
Internal method for getting the next document from the cursor.
Original file line number Diff line number Diff line change 32
32
from typing import Union , List
33
33
import json
34
34
35
- from . import connection
35
+ from . import connection , errors
36
36
37
37
class SodaDatabase :
38
38
@@ -421,6 +421,8 @@ def __iter__(self):
421
421
return self
422
422
423
423
def __next__ (self ):
424
+ if self ._impl is None :
425
+ errors ._raise_err (errors .ERR_CURSOR_NOT_OPEN )
424
426
doc_impl = self ._impl .get_next_doc ()
425
427
if doc_impl is not None :
426
428
return SodaDocument ._from_impl (doc_impl )
@@ -438,7 +440,10 @@ def close(self) -> None:
438
440
cursor will be unusable from this point forward; an Error exception
439
441
will be raised if any operation is attempted with the cursor.
440
442
"""
443
+ if self ._impl is None :
444
+ errors ._raise_err (errors .ERR_CURSOR_NOT_OPEN )
441
445
self ._impl .close ()
446
+ self ._impl = None
442
447
443
448
444
449
class SodaOperation :
You can’t perform that action at this time.
0 commit comments