line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include "perlbolt.h" |
2
|
|
|
|
|
|
|
#include "ingyINLINE.h" |
3
|
|
|
|
|
|
|
|
4
|
0
|
|
|
|
|
|
void fetch_next_ (SV *rs_ref) { |
5
|
|
|
|
|
|
|
SV *perl_value; |
6
|
|
|
|
|
|
|
rs_obj_t *rs_obj; |
7
|
|
|
|
|
|
|
neo4j_result_t *result; |
8
|
|
|
|
|
|
|
neo4j_result_stream_t *rs; |
9
|
|
|
|
|
|
|
neo4j_value_t value; |
10
|
|
|
|
|
|
|
struct neo4j_update_counts cts; |
11
|
|
|
|
|
|
|
int i,n,fail; |
12
|
0
|
|
|
|
|
|
Inline_Stack_Vars; |
13
|
0
|
|
|
|
|
|
Inline_Stack_Reset; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
rs_obj = C_PTR_OF(rs_ref,rs_obj_t); |
16
|
0
|
0
|
|
|
|
|
if (rs_obj->fetched == 1) { |
17
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
18
|
0
|
|
|
|
|
|
return; |
19
|
|
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
reset_errstate_rs_obj(rs_obj); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
rs = rs_obj->res_stream; |
23
|
0
|
|
|
|
|
|
n = neo4j_nfields(rs); |
24
|
0
|
0
|
|
|
|
|
if (!n) { |
25
|
0
|
|
|
|
|
|
fail = update_errstate_rs_obj(rs_obj); |
26
|
0
|
0
|
|
|
|
|
if (fail) { |
27
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
28
|
0
|
|
|
|
|
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
result = neo4j_fetch_next(rs); |
32
|
0
|
0
|
|
|
|
|
if (result == NULL) { |
33
|
0
|
0
|
|
|
|
|
if (errno) { |
34
|
0
|
|
|
|
|
|
fail = update_errstate_rs_obj(rs_obj); |
35
|
|
|
|
|
|
|
} else { |
36
|
0
|
|
|
|
|
|
rs_obj->fetched = 1; |
37
|
|
|
|
|
|
|
// collect stats |
38
|
0
|
|
|
|
|
|
cts = neo4j_update_counts(rs); |
39
|
0
|
|
|
|
|
|
rs_obj->stats->result_count = neo4j_result_count(rs); |
40
|
0
|
|
|
|
|
|
rs_obj->stats->available_after = neo4j_results_available_after(rs); |
41
|
0
|
|
|
|
|
|
rs_obj->stats->consumed_after = neo4j_results_consumed_after(rs); |
42
|
0
|
|
|
|
|
|
memcpy(rs_obj->stats->update_counts, &cts, sizeof(struct neo4j_update_counts)); |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
45
|
0
|
|
|
|
|
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
0
|
|
|
|
|
for (i=0; i
|
48
|
0
|
|
|
|
|
|
value = neo4j_result_field(result, i); |
49
|
0
|
|
|
|
|
|
perl_value = neo4j_value_to_SV(value); |
50
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( perl_value ); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
53
|
0
|
|
|
|
|
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
int nfields_(SV *rs_ref) { |
57
|
0
|
0
|
|
|
|
|
return neo4j_nfields( C_PTR_OF(rs_ref,rs_obj_t)->res_stream ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
void fieldnames_ (SV *rs_ref) { |
61
|
|
|
|
|
|
|
neo4j_result_stream_t *rs; |
62
|
|
|
|
|
|
|
int nfields; |
63
|
|
|
|
|
|
|
int i; |
64
|
0
|
0
|
|
|
|
|
rs = C_PTR_OF(rs_ref,rs_obj_t)->res_stream; |
65
|
0
|
|
|
|
|
|
nfields = neo4j_nfields(rs); |
66
|
0
|
|
|
|
|
|
Inline_Stack_Vars; |
67
|
0
|
|
|
|
|
|
Inline_Stack_Reset; |
68
|
0
|
0
|
|
|
|
|
for (i = 0; i < nfields; i++) |
69
|
0
|
0
|
|
|
|
|
Inline_Stack_Push(sv_2mortal(newSVpv(neo4j_fieldname(rs,i),0))); |
70
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
71
|
0
|
|
|
|
|
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
int success_ (SV *rs_ref) { |
75
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->succeed; |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
int failure_ (SV *rs_ref) { |
78
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->fail; |
79
|
|
|
|
|
|
|
} |
80
|
0
|
|
|
|
|
|
int client_errnum_ (SV *rs_ref) { |
81
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->errnum; |
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
|
const char *server_errcode_ (SV *rs_ref) { |
84
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->eval_errcode; |
85
|
|
|
|
|
|
|
} |
86
|
0
|
|
|
|
|
|
const char *server_errmsg_ (SV *rs_ref) { |
87
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->eval_errmsg; |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
const char *client_errmsg_ (SV *rs_ref) { |
90
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->strerror; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
UV result_count_ (SV *rs_ref) { |
94
|
0
|
0
|
|
|
|
|
if (C_PTR_OF(rs_ref,rs_obj_t)->fetched == 1) { |
|
|
0
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->stats->result_count; |
96
|
|
|
|
|
|
|
} else { |
97
|
0
|
|
|
|
|
|
return 0; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
0
|
|
|
|
|
|
UV available_after_ (SV *rs_ref) { |
101
|
0
|
0
|
|
|
|
|
if (C_PTR_OF(rs_ref,rs_obj_t)->fetched == 1) { |
|
|
0
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->stats->available_after; |
103
|
|
|
|
|
|
|
} else { |
104
|
0
|
|
|
|
|
|
return 0; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
0
|
|
|
|
|
|
UV consumed_after_ (SV *rs_ref) { |
108
|
0
|
0
|
|
|
|
|
if (C_PTR_OF(rs_ref,rs_obj_t)->fetched == 1) { |
|
|
0
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
return C_PTR_OF(rs_ref,rs_obj_t)->stats->consumed_after; |
110
|
|
|
|
|
|
|
} else { |
111
|
0
|
|
|
|
|
|
return 0; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
SV *get_failure_details(SV *rs_ref) { |
116
|
0
|
0
|
|
|
|
|
rs_obj_t *rs_obj = C_PTR_OF(rs_ref,rs_obj_t); |
117
|
0
|
|
|
|
|
|
neo4j_result_stream_t *rs = rs_obj->res_stream; |
118
|
0
|
|
|
|
|
|
const struct neo4j_failure_details *faild = neo4j_failure_details(rs_obj->res_stream); |
119
|
|
|
|
|
|
|
// if (faild->line == 0) |
120
|
|
|
|
|
|
|
// { |
121
|
|
|
|
|
|
|
// return &PL_sv_undef; |
122
|
|
|
|
|
|
|
// } |
123
|
0
|
|
|
|
|
|
HV *hv = newHV(); |
124
|
|
|
|
|
|
|
// UTF-8 issues here? need SvUTF8_on(pv)? |
125
|
0
|
|
|
|
|
|
hv_stores(hv, "code", newSVpv(faild->code,0)); |
126
|
0
|
|
|
|
|
|
hv_stores(hv, "message", newSVpv(faild->message,0)); |
127
|
0
|
|
|
|
|
|
hv_stores(hv, "description", newSVpv(faild->description,0)); |
128
|
0
|
|
|
|
|
|
hv_stores(hv, "context", newSVpv(faild->context,0)); |
129
|
0
|
|
|
|
|
|
hv_stores(hv, "line", newSViv( (IV) faild->line )); |
130
|
0
|
|
|
|
|
|
hv_stores(hv, "column", newSViv( (IV) faild->column )); |
131
|
0
|
|
|
|
|
|
hv_stores(hv, "offset", newSViv( (IV) faild->offset )); |
132
|
0
|
|
|
|
|
|
hv_stores(hv, "context_offset", newSViv( (IV) faild->context_offset )); |
133
|
0
|
|
|
|
|
|
SV* sv = newRV_noinc( (SV*)hv ); |
134
|
0
|
|
|
|
|
|
SvREADONLY_on(sv); |
135
|
0
|
|
|
|
|
|
return sv; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
void update_counts_ (SV *rs_ref) { |
140
|
|
|
|
|
|
|
struct neo4j_update_counts *uc; |
141
|
0
|
|
|
|
|
|
Inline_Stack_Vars; |
142
|
0
|
|
|
|
|
|
Inline_Stack_Reset; |
143
|
0
|
0
|
|
|
|
|
if (C_PTR_OF(rs_ref,rs_obj_t)->fetched != 1) { |
|
|
0
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
145
|
0
|
|
|
|
|
|
return; |
146
|
|
|
|
|
|
|
} |
147
|
0
|
0
|
|
|
|
|
uc = C_PTR_OF(rs_ref,rs_obj_t)->stats->update_counts; |
148
|
|
|
|
|
|
|
|
149
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->nodes_created )); |
150
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->nodes_deleted )); |
151
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->relationships_created )); |
152
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->relationships_deleted )); |
153
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->properties_set )); |
154
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->labels_added )); |
155
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->labels_removed )); |
156
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->indexes_added )); |
157
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->indexes_removed )); |
158
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->constraints_added )); |
159
|
0
|
0
|
|
|
|
|
Inline_Stack_Push( newSViv( (const UV) uc->constraints_removed )); |
160
|
0
|
|
|
|
|
|
Inline_Stack_Done; |
161
|
0
|
|
|
|
|
|
return; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
|
void DESTROY (SV *rs_ref) { |
165
|
|
|
|
|
|
|
rs_obj_t *rs_obj; |
166
|
0
|
0
|
|
|
|
|
rs_obj = C_PTR_OF(rs_ref,rs_obj_t); |
167
|
0
|
|
|
|
|
|
neo4j_close_results(rs_obj->res_stream); |
168
|
0
|
|
|
|
|
|
Safefree(rs_obj->stats->update_counts); |
169
|
0
|
|
|
|
|
|
Safefree(rs_obj->stats); |
170
|
0
|
|
|
|
|
|
Safefree(rs_obj); |
171
|
0
|
|
|
|
|
|
return; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
MODULE = Neo4j::Bolt::ResultStream PACKAGE = Neo4j::Bolt::ResultStream |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
void |
181
|
|
|
|
|
|
|
fetch_next_ (rs_ref) |
182
|
|
|
|
|
|
|
SV * rs_ref |
183
|
|
|
|
|
|
|
PREINIT: |
184
|
|
|
|
|
|
|
I32* temp; |
185
|
|
|
|
|
|
|
PPCODE: |
186
|
0
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
187
|
0
|
|
|
|
|
|
fetch_next_(rs_ref); |
188
|
0
|
0
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
189
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
190
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
191
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
194
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
int |
197
|
|
|
|
|
|
|
nfields_ (rs_ref) |
198
|
|
|
|
|
|
|
SV * rs_ref |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
void |
201
|
|
|
|
|
|
|
fieldnames_ (rs_ref) |
202
|
|
|
|
|
|
|
SV * rs_ref |
203
|
|
|
|
|
|
|
PREINIT: |
204
|
|
|
|
|
|
|
I32* temp; |
205
|
|
|
|
|
|
|
PPCODE: |
206
|
0
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
207
|
0
|
|
|
|
|
|
fieldnames_(rs_ref); |
208
|
0
|
0
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
209
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
210
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
211
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
214
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
int |
217
|
|
|
|
|
|
|
success_ (rs_ref) |
218
|
|
|
|
|
|
|
SV * rs_ref |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
int |
221
|
|
|
|
|
|
|
failure_ (rs_ref) |
222
|
|
|
|
|
|
|
SV * rs_ref |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
int |
225
|
|
|
|
|
|
|
client_errnum_ (rs_ref) |
226
|
|
|
|
|
|
|
SV * rs_ref |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
const char * |
229
|
|
|
|
|
|
|
server_errcode_ (rs_ref) |
230
|
|
|
|
|
|
|
SV * rs_ref |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
const char * |
233
|
|
|
|
|
|
|
server_errmsg_ (rs_ref) |
234
|
|
|
|
|
|
|
SV * rs_ref |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
const char * |
237
|
|
|
|
|
|
|
client_errmsg_ (rs_ref) |
238
|
|
|
|
|
|
|
SV * rs_ref |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
UV |
241
|
|
|
|
|
|
|
result_count_ (rs_ref) |
242
|
|
|
|
|
|
|
SV * rs_ref |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
UV |
245
|
|
|
|
|
|
|
available_after_ (rs_ref) |
246
|
|
|
|
|
|
|
SV * rs_ref |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
UV |
249
|
|
|
|
|
|
|
consumed_after_ (rs_ref) |
250
|
|
|
|
|
|
|
SV * rs_ref |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
SV * |
253
|
|
|
|
|
|
|
get_failure_details (rs_ref) |
254
|
|
|
|
|
|
|
SV * rs_ref |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
void |
257
|
|
|
|
|
|
|
update_counts_ (rs_ref) |
258
|
|
|
|
|
|
|
SV * rs_ref |
259
|
|
|
|
|
|
|
PREINIT: |
260
|
|
|
|
|
|
|
I32* temp; |
261
|
|
|
|
|
|
|
PPCODE: |
262
|
0
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
263
|
0
|
|
|
|
|
|
update_counts_(rs_ref); |
264
|
0
|
0
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
265
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
266
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
267
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
270
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
void |
273
|
|
|
|
|
|
|
DESTROY (rs_ref) |
274
|
|
|
|
|
|
|
SV * rs_ref |
275
|
|
|
|
|
|
|
PREINIT: |
276
|
|
|
|
|
|
|
I32* temp; |
277
|
|
|
|
|
|
|
PPCODE: |
278
|
0
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
279
|
0
|
|
|
|
|
|
DESTROY(rs_ref); |
280
|
0
|
0
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
281
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
282
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
283
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
286
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
287
|
|
|
|
|
|
|
|