@@ -48,11 +48,11 @@ def __init__(self, connection, on_error):
48
48
connection raises of of the caught errors.
49
49
:type on_error callable
50
50
"""
51
- self ._connection = connection
52
- self ._on_error = on_error
51
+ self .connection = connection
52
+ self .on_error = on_error
53
53
54
54
def __getattr__ (self , item ):
55
- connection_attr = getattr (self ._connection , item )
55
+ connection_attr = getattr (self .connection , item )
56
56
if not callable (connection_attr ):
57
57
return connection_attr
58
58
@@ -61,7 +61,7 @@ def inner(*args, **kwargs):
61
61
try :
62
62
func (* args , ** kwargs )
63
63
except (Neo4jError , ServiceUnavailable , SessionExpired ) as exc :
64
- self ._on_error (exc )
64
+ self .on_error (exc )
65
65
raise
66
66
return inner
67
67
@@ -83,7 +83,7 @@ def __init__(self, connection, hydrant, fetch_size, on_closed,
83
83
self ._record_buffer = deque ()
84
84
self ._summary = None
85
85
self ._bookmark = None
86
- self ._qid = - 1
86
+ self ._raw_qid = - 1
87
87
self ._fetch_size = fetch_size
88
88
89
89
# states
@@ -96,6 +96,13 @@ def __init__(self, connection, hydrant, fetch_size, on_closed,
96
96
# the result has been fully iterated or consumed
97
97
self ._closed = False
98
98
99
+ @property
100
+ def _qid (self ):
101
+ if self ._raw_qid == self ._connection .connection .most_recent_qid :
102
+ return - 1
103
+ else :
104
+ return self ._raw_qid
105
+
99
106
def _tx_ready_run (self , query , parameters , ** kwparameters ):
100
107
# BEGIN+RUN does not carry any extra on the RUN message.
101
108
# BEGIN {extra}
@@ -117,7 +124,10 @@ def _run(self, query, parameters, db, access_mode, bookmarks, **kwparameters):
117
124
118
125
def on_attached (metadata ):
119
126
self ._metadata .update (metadata )
120
- self ._qid = metadata .get ("qid" , - 1 ) # For auto-commit there is no qid and Bolt 3 do not support qid
127
+ # For auto-commit there is no qid and Bolt 3 does not support qid
128
+ self ._raw_qid = metadata .get ("qid" , - 1 )
129
+ if self ._raw_qid != - 1 :
130
+ self ._connection .connection .most_recent_qid = self ._raw_qid
121
131
self ._keys = metadata .get ("fields" )
122
132
self ._attached = True
123
133
0 commit comments