Fixed bug closing a SODA document cursor explicitly (instead of simply
allowing it to be closed automatically when it goes out of scope).
This commit is contained in:
parent
f431ad2996
commit
ec10d76096
|
@ -25,6 +25,8 @@ Thick Mode Changes
|
|||
|
||||
#) Fixed bug creating a homogeneous connection pool with a proxy user
|
||||
(`issue 101 <https://github.com/oracle/python-oracledb/issues/101>`__).
|
||||
#) Fixed bug closing a SODA document cursor explicitly (instead of simply
|
||||
allowing it to be closed automatically when it goes out of scope).
|
||||
|
||||
Common Changes
|
||||
++++++++++++++
|
||||
|
|
|
@ -570,6 +570,16 @@ cdef class ThickSodaDocCursorImpl(BaseSodaDocCursorImpl):
|
|||
if self._handle != NULL:
|
||||
dpiSodaDocCursor_release(self._handle)
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Internal method for closing the cursor.
|
||||
"""
|
||||
cdef int status
|
||||
with nogil:
|
||||
status = dpiSodaDocCursor_close(self._handle)
|
||||
if status < 0:
|
||||
_raise_from_odpi()
|
||||
|
||||
def get_next_doc(self):
|
||||
"""
|
||||
Internal method for getting the next document from the cursor.
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
from typing import Union, List
|
||||
import json
|
||||
|
||||
from . import connection
|
||||
from . import connection, errors
|
||||
|
||||
class SodaDatabase:
|
||||
|
||||
|
@ -421,6 +421,8 @@ class SodaDocCursor:
|
|||
return self
|
||||
|
||||
def __next__(self):
|
||||
if self._impl is None:
|
||||
errors._raise_err(errors.ERR_CURSOR_NOT_OPEN)
|
||||
doc_impl = self._impl.get_next_doc()
|
||||
if doc_impl is not None:
|
||||
return SodaDocument._from_impl(doc_impl)
|
||||
|
@ -438,7 +440,10 @@ class SodaDocCursor:
|
|||
cursor will be unusable from this point forward; an Error exception
|
||||
will be raised if any operation is attempted with the cursor.
|
||||
"""
|
||||
if self._impl is None:
|
||||
errors._raise_err(errors.ERR_CURSOR_NOT_OPEN)
|
||||
self._impl.close()
|
||||
self._impl = None
|
||||
|
||||
|
||||
class SodaOperation:
|
||||
|
|
Loading…
Reference in New Issue