@@ -148,7 +148,7 @@ def recycle(self, session):
148148 pool .appendleft (session )
149149
150150
151- class ResultCursor (object ):
151+ class StatementResult (object ):
152152 """ A handler for the result of Cypher statement execution.
153153 """
154154
@@ -163,7 +163,7 @@ class ResultCursor(object):
163163 summary = None
164164
165165 def __init__ (self , connection , run_response , pull_all_response ):
166- super (ResultCursor , self ).__init__ ()
166+ super (StatementResult , self ).__init__ ()
167167
168168 # The Connection instance behind this cursor.
169169 self .connection = connection
@@ -205,6 +205,9 @@ def on_failure(metadata):
205205 pull_all_response .on_success = on_footer
206206 pull_all_response .on_failure = on_failure
207207
208+ def __iter__ (self ):
209+ return self
210+
208211 def __next__ (self ):
209212 if self ._buffer :
210213 values = self ._buffer .popleft ()
@@ -216,10 +219,15 @@ def __next__(self):
216219 self .connection .fetch ()
217220 return self .__next__ ()
218221
219- def __iter__ (self ):
220- return self
222+ def keys (self ):
223+ """ Return the keys for the records.
224+ """
225+ # Fetch messages until we have the header or a failure
226+ while self ._keys is None and not self ._consumed :
227+ self .connection .fetch ()
228+ return self ._keys
221229
222- def close (self ):
230+ def discard (self ):
223231 """ Consume the remainder of this result and detach the connection
224232 from this cursor.
225233 """
@@ -229,17 +237,9 @@ def close(self):
229237 fetch ()
230238 self .connection = None
231239
232- def keys (self ):
233- """ Return the keys for the records.
234- """
235- # Fetch messages until we have the header or a failure
236- while self ._keys is None and not self ._consumed :
237- self .connection .fetch ()
238- return self ._keys
239-
240240
241241class ResultSummary (object ):
242- """ A summary of execution returned with a :class:`.ResultCursor ` object.
242+ """ A summary of execution returned with a :class:`.StatementResult ` object.
243243 """
244244
245245 #: The statement that was executed to produce this result.
@@ -408,7 +408,7 @@ def __init__(self, driver):
408408 self .driver = driver
409409 self .connection = connect (driver .host , driver .port , driver .ssl_context , ** driver .config )
410410 self .transaction = None
411- self .last_cursor = None
411+ self .last_result = None
412412
413413 def __del__ (self ):
414414 try :
@@ -437,7 +437,7 @@ def run(self, statement, parameters=None):
437437 :param statement: Cypher statement to execute
438438 :param parameters: dictionary of parameters
439439 :return: Cypher result
440- :rtype: :class:`.ResultCursor `
440+ :rtype: :class:`.StatementResult `
441441 """
442442
443443 # Ensure the statement is a Unicode value
@@ -456,22 +456,22 @@ def run(self, statement, parameters=None):
456456
457457 run_response = Response (self .connection )
458458 pull_all_response = Response (self .connection )
459- cursor = ResultCursor (self .connection , run_response , pull_all_response )
459+ cursor = StatementResult (self .connection , run_response , pull_all_response )
460460 cursor .statement = statement
461461 cursor .parameters = parameters
462462
463463 self .connection .append (RUN , (statement , parameters ), response = run_response )
464464 self .connection .append (PULL_ALL , response = pull_all_response )
465465 self .connection .send ()
466466
467- self .last_cursor = cursor
467+ self .last_result = cursor
468468 return cursor
469469
470470 def close (self ):
471471 """ Recycle this session through the driver it came from.
472472 """
473- if self .last_cursor :
474- self .last_cursor . close ()
473+ if self .last_result :
474+ self .last_result . discard ()
475475 self .driver .recycle (self )
476476
477477 def begin_transaction (self ):
0 commit comments