@@ -103,6 +103,14 @@ def session(self, **config):
103103
104104
105105class Result (list ):
106+ """ A handler for the result of Cypher statement execution.
107+ """
108+
109+ #: The statement that was executed to produce this result.
110+ statement = None
111+
112+ #: Dictionary of parameters passed with the statement.
113+ parameters = None
106114
107115 def __init__ (self , session , statement , parameters ):
108116 super (Result , self ).__init__ ()
@@ -115,34 +123,63 @@ def __init__(self, session, statement, parameters):
115123 self .bench_test = None
116124
117125 def on_header (self , metadata ):
126+ """ Called on receipt of the result header.
127+ """
118128 self .keys = metadata ["fields" ]
119129 if self .bench_test :
120130 self .bench_test .start_recv = perf_counter ()
121131
122132 def on_record (self , values ):
133+ """ Called on receipt of each result record.
134+ """
123135 self .append (Record (self .keys , tuple (map (hydrated , values ))))
124136
125137 def on_footer (self , metadata ):
138+ """ Called on receipt of the result footer.
139+ """
126140 self .complete = True
127141 self .summary = ResultSummary (self .statement , self .parameters ,
128142 metadata .get ("type" ), metadata .get ("stats" ))
129143 if self .bench_test :
130144 self .bench_test .end_recv = perf_counter ()
131145
132146 def on_failure (self , metadata ):
147+ """ Called on execution failure.
148+ """
133149 raise CypherError (metadata )
134150
135151 def consume (self ):
152+ """ Consume the remainder of this result, triggering all appropriate
153+ callback functions.
154+ """
136155 fetch_next = self .session .connection .fetch_next
137156 while not self .complete :
138157 fetch_next ()
139158
140159 def summarize (self ):
160+ """ Consume the remainder of this result and produce a summary.
161+
162+ :rtype: ResultSummary
163+ """
141164 self .consume ()
142165 return self .summary
143166
144167
145168class ResultSummary (object ):
169+ """ A summary of execution returned with a :class:`.Result` object.
170+ """
171+
172+ #: The statement that was executed to produce this result.
173+ statement = None
174+
175+ #: Dictionary of parameters passed with the statement.
176+ parameters = None
177+
178+ #: The type of statement (``'r'`` = read-only, ``'rw'`` = read/write).
179+ statement_type = None
180+
181+ #: A set of statistical information held in a :class:`.StatementStatistics` instance.
182+ statistics = None
146183
147184 def __init__ (self , statement , parameters , statement_type , statistics ):
148185 self .statement = statement
@@ -152,17 +189,43 @@ def __init__(self, statement, parameters, statement_type, statistics):
152189
153190
154191class StatementStatistics (object ):
192+ """ Set of statistics from a Cypher statement execution.
193+ """
194+
195+ #:
155196 contains_updates = False
197+
198+ #:
156199 nodes_created = 0
200+
201+ #:
157202 nodes_deleted = 0
203+
204+ #:
158205 relationships_created = 0
206+
207+ #:
159208 relationships_deleted = 0
209+
210+ #:
160211 properties_set = 0
212+
213+ #:
161214 labels_added = 0
215+
216+ #:
162217 labels_removed = 0
218+
219+ #:
163220 indexes_added = 0
221+
222+ #:
164223 indexes_removed = 0
224+
225+ #:
165226 constraints_added = 0
227+
228+ #:
166229 constraints_removed = 0
167230
168231 def __init__ (self , statistics ):
0 commit comments