| line |
true |
false |
branch |
|
252
|
0 |
0 |
if (cbt_freelist) { |
|
275
|
0 |
0 |
if (send_freelist) { |
|
292
|
0 |
0 |
if (s->query_id) { Safefree(s->query_id); s->query_id = NULL; } |
|
300
|
0 |
0 |
if (!self->reading && self->fd >= 0) { |
|
|
0 |
0 |
if (!self->reading && self->fd >= 0) { |
|
307
|
0 |
0 |
if (self->reading) { |
|
314
|
0 |
0 |
if (!self->writing && self->fd >= 0) { |
|
|
0 |
0 |
if (!self->writing && self->fd >= 0) { |
|
321
|
0 |
0 |
if (self->writing) { |
|
328
|
0 |
0 |
if (self->magic == EV_CH_FREED && self->callback_depth == 0) { |
|
|
0 |
0 |
if (self->magic == EV_CH_FREED && self->callback_depth == 0) { |
|
336
|
0 |
0 |
if (NULL == self->on_error) return; |
|
341
|
0 |
0 |
PUSHMARK(SP); |
|
342
|
0 |
0 |
XPUSHs(sv_2mortal(newSVpv(msg, 0))); |
|
346
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
347
|
0 |
0 |
warn("EV::ClickHouse: exception in error handler: %s", SvPV_nolen(ERRSV)); |
|
350
|
0 |
0 |
FREETMPS; |
|
357
|
0 |
0 |
if (NULL == self->on_trace) return; |
|
366
|
0 |
0 |
PUSHMARK(SP); |
|
367
|
0 |
0 |
XPUSHs(sv_2mortal(newSVpv(buf, 0))); |
|
370
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
371
|
0 |
0 |
warn("EV::ClickHouse: exception in trace handler: %s", SvPV_nolen(ERRSV)); |
|
372
|
0 |
0 |
FREETMPS; |
|
382
|
0 |
0 |
if (ngx_queue_empty(&self->cb_queue)) return NULL; |
|
388
|
0 |
0 |
if (cbt->on_data) { SvREFCNT_dec(cbt->on_data); cbt->on_data = NULL; } |
|
400
|
0 |
0 |
if (ngx_queue_empty(&self->cb_queue)) return NULL; |
|
409
|
0 |
0 |
if (ngx_queue_empty(&self->cb_queue)) return 0; |
|
417
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
418
|
0 |
0 |
warn("EV::ClickHouse: exception in callback: %s", SvPV_nolen(ERRSV)); |
|
426
|
0 |
0 |
if (cb == NULL) return 0; |
|
433
|
0 |
0 |
PUSHMARK(SP); |
|
438
|
0 |
0 |
FREETMPS; |
|
448
|
0 |
0 |
if (cb == NULL) { |
|
449
|
0 |
0 |
if (rows) SvREFCNT_dec((SV*)rows); |
|
458
|
0 |
0 |
PUSHMARK(SP); |
|
459
|
0 |
0 |
if (rows) { |
|
466
|
0 |
0 |
FREETMPS; |
|
476
|
0 |
0 |
if (cb == NULL) return 0; |
|
483
|
0 |
0 |
PUSHMARK(SP); |
|
487
|
0 |
0 |
FREETMPS; |
|
499
|
0 |
0 |
cbt->on_data = on_data ? SvREFCNT_inc(on_data) : NULL; |
|
506
|
0 |
0 |
if (has_arg) { |
|
507
|
0 |
0 |
if (NULL != *slot) { |
|
511
|
0 |
0 |
if (NULL != handler && SvOK(handler) && |
|
|
0 |
0 |
if (NULL != handler && SvOK(handler) && |
|
512
|
0 |
0 |
SvROK(handler) && SvTYPE(SvRV(handler)) == SVt_PVCV) { |
|
|
0 |
0 |
SvROK(handler) && SvTYPE(SvRV(handler)) == SVt_PVCV) { |
|
516
|
0 |
0 |
return (NULL != *slot) ? SvREFCNT_inc(*slot) : &PL_sv_undef; |
|
522
|
0 |
0 |
if (!s) return NULL; |
|
530
|
0 |
0 |
if (!s) return 0; |
|
531
|
0 |
0 |
for (; *s; s++) |
|
532
|
0 |
0 |
if (*s == '\r' || *s == '\n') return 1; |
|
|
0 |
0 |
if (*s == '\r' || *s == '\n') return 1; |
|
546
|
0 |
0 |
if (was_connected) emit_trace(self, "disconnect"); |
|
550
|
0 |
0 |
if (self->timing) { |
|
556
|
0 |
0 |
if (self->ssl) { |
|
561
|
0 |
0 |
if (self->ssl_ctx) { |
|
567
|
0 |
0 |
if (self->fd >= 0) { |
|
576
|
0 |
0 |
if (was_connected && NULL != self->on_disconnect) { |
|
|
0 |
0 |
if (was_connected && NULL != self->on_disconnect) { |
|
582
|
0 |
0 |
PUSHMARK(SP); |
|
585
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
586
|
0 |
0 |
warn("EV::ClickHouse: exception in disconnect handler: %s", |
|
588
|
0 |
0 |
FREETMPS; |
|
598
|
0 |
0 |
if (self->native_rows) { |
|
602
|
0 |
0 |
if (self->native_col_names) { |
|
606
|
0 |
0 |
if (self->native_col_types) { |
|
610
|
0 |
0 |
if (self->native_totals) { |
|
614
|
0 |
0 |
if (self->native_extremes) { |
|
619
|
0 |
0 |
if (self->insert_data) { |
|
624
|
0 |
0 |
if (self->insert_av) { |
|
628
|
0 |
0 |
if (self->insert_err) { |
|
638
|
0 |
0 |
while (!ngx_queue_empty(&self->send_queue)) { |
|
644
|
0 |
0 |
if (send->insert_data) Safefree(send->insert_data); |
|
645
|
0 |
0 |
if (send->insert_av) { SvREFCNT_dec(send->insert_av); send->insert_av = NULL; } |
|
646
|
0 |
0 |
if (send->on_data) { SvREFCNT_dec(send->on_data); send->on_data = NULL; } |
|
654
|
0 |
0 |
PUSHMARK(SP); |
|
659
|
0 |
0 |
FREETMPS; |
|
662
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) break; |
|
665
|
0 |
0 |
while (!ngx_queue_empty(&self->cb_queue)) { |
|
667
|
0 |
0 |
if (cb == NULL) break; |
|
673
|
0 |
0 |
PUSHMARK(SP); |
|
678
|
0 |
0 |
FREETMPS; |
|
681
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) break; |
|
693
|
0 |
0 |
if (self->ssl) { |
|
694
|
0 |
0 |
int ssl_len = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; |
|
696
|
0 |
0 |
if (ret <= 0) { |
|
698
|
0 |
0 |
if (err == SSL_ERROR_WANT_READ) { |
|
702
|
0 |
0 |
if (err == SSL_ERROR_WANT_WRITE) { |
|
707
|
0 |
0 |
if (err == SSL_ERROR_ZERO_RETURN) return 0; |
|
719
|
0 |
0 |
if (self->ssl) { |
|
720
|
0 |
0 |
int ssl_len = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; |
|
722
|
0 |
0 |
if (ret <= 0) { |
|
724
|
0 |
0 |
if (err == SSL_ERROR_WANT_WRITE) { |
|
728
|
0 |
0 |
if (err == SSL_ERROR_WANT_READ) { |
|
745
|
0 |
0 |
if (self->recv_cap >= need) return; |
|
746
|
0 |
0 |
if (need > SIZE_MAX / 2) croak("recv buffer overflow"); |
|
748
|
0 |
0 |
if (newcap < need) newcap = need; |
|
754
|
0 |
0 |
if (self->send_cap >= need) return; |
|
755
|
0 |
0 |
if (need > SIZE_MAX / 2) croak("send buffer overflow"); |
|
757
|
0 |
0 |
if (newcap < need) newcap = need; |
|
777
|
0 |
0 |
if (b->len + need > b->cap) { |
|
778
|
0 |
0 |
while (b->len + need > b->cap) { |
|
779
|
0 |
0 |
if (b->cap > SIZE_MAX / 2) croak("native buffer overflow"); |
|
794
|
0 |
0 |
while (n >= 0x80) { |
|
807
|
0 |
0 |
nbuf_string(b, s, s ? strlen(s) : 0); |
|
822
|
0 |
0 |
while (p < len) { |
|
825
|
0 |
0 |
if (!(byte & 0x80)) { |
|
831
|
0 |
0 |
if (shift >= 64) return -1; |
|
841
|
0 |
0 |
if (rc <= 0) { *pos = saved; return rc; } |
|
842
|
0 |
0 |
if (slen > len - *pos) { *pos = saved; return 0; } |
|
846
|
0 |
0 |
if (out_len) *out_len = (size_t)slen; |
|
857
|
0 |
0 |
if (rc <= 0) { *pos = saved; return rc; } |
|
858
|
0 |
0 |
if (slen > len - *pos) { *pos = saved; return 0; } |
|
866
|
0 |
0 |
if (*pos + 1 > len) return 0; |
|
873
|
0 |
0 |
if (*pos + 4 > len) return 0; |
|
890
|
0 |
0 |
if (rc <= 0) { *pos = saved; return rc; } |
|
891
|
0 |
0 |
if (slen > len - *pos) { *pos = saved; return 0; } |
|
902
|
0 |
0 |
for (i = 0; i < src_len; i++) { |
|
904
|
0 |
0 |
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || |
|
|
0 |
0 |
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || |
|
|
0 |
0 |
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || |
|
|
0 |
0 |
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || |
|
|
0 |
0 |
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || |
|
905
|
0 |
0 |
(c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { |
|
|
0 |
0 |
(c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { |
|
|
0 |
0 |
(c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { |
|
|
0 |
0 |
(c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { |
|
|
0 |
0 |
(c >= '0' && c <= '9') || c == '-' || c == '_' || c == '.' || c == '~') { |
|
921
|
0 |
0 |
return (klen == 3 && memcmp(key, "raw", 3) == 0) |
|
922
|
0 |
0 |
|| (klen == 8 && memcmp(key, "query_id", 8) == 0) |
|
|
0 |
0 |
|| (klen == 8 && memcmp(key, "query_id", 8) == 0) |
|
923
|
0 |
0 |
|| (klen == 7 && memcmp(key, "on_data", 7) == 0) |
|
|
0 |
0 |
|| (klen == 7 && memcmp(key, "on_data", 7) == 0) |
|
924
|
0 |
0 |
|| (klen == 13 && memcmp(key, "query_timeout", 13) == 0) |
|
|
0 |
0 |
|| (klen == 13 && memcmp(key, "query_timeout", 13) == 0) |
|
925
|
0 |
0 |
|| (klen == 6 && memcmp(key, "params", 6) == 0); |
|
|
0 |
0 |
|| (klen == 6 && memcmp(key, "params", 6) == 0); |
|
|
0 |
0 |
|| (klen == 6 && memcmp(key, "params", 6) == 0); |
|
931
|
0 |
0 |
if (overrides) { |
|
933
|
0 |
0 |
while ((entry = hv_iternext(overrides))) { |
|
937
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
942
|
0 |
0 |
if (defaults) { |
|
944
|
0 |
0 |
while ((entry = hv_iternext(defaults))) { |
|
948
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
950
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
970
|
0 |
0 |
if (overrides) { |
|
972
|
0 |
0 |
while ((entry = hv_iternext(overrides))) { |
|
977
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
982
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
990
|
0 |
0 |
if (defaults) { |
|
992
|
0 |
0 |
while ((entry = hv_iternext(defaults))) { |
|
997
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
999
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
1000
|
0 |
0 |
if (!*query_id_out) { |
|
1006
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
1022
|
0 |
0 |
if (query_id_out) *query_id_out = NULL; |
|
1023
|
0 |
0 |
if (query_id_len_out) *query_id_len_out = 0; |
|
1025
|
0 |
0 |
if (overrides) { |
|
1027
|
0 |
0 |
while ((entry = hv_iternext(overrides))) { |
|
1032
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
1033
|
0 |
0 |
if (query_id_out) { |
|
1039
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
1041
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) continue; |
|
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) continue; |
|
1049
|
0 |
0 |
if (defaults) { |
|
1051
|
0 |
0 |
while ((entry = hv_iternext(defaults))) { |
|
1056
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
1058
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
|
0 |
0 |
if (klen == 8 && memcmp(key, "query_id", 8) == 0) { |
|
1059
|
0 |
0 |
if (query_id_out && !*query_id_out) { |
|
|
0 |
0 |
if (query_id_out && !*query_id_out) { |
|
1065
|
0 |
0 |
if (is_client_only_key(key, klen)) continue; |
|
1066
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) continue; |
|
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) continue; |
|
1085
|
0 |
0 |
if (data_len > (size_t)UINT_MAX) return NULL; |
|
1089
|
0 |
0 |
if (ret != Z_OK) return NULL; |
|
1092
|
0 |
0 |
if (out_cap > (size_t)UINT_MAX) { deflateEnd(&strm); return NULL; } |
|
1101
|
0 |
0 |
if (ret != Z_STREAM_END) { |
|
1119
|
0 |
0 |
if (data_len > (size_t)UINT_MAX) return NULL; |
|
1123
|
0 |
0 |
if (ret != Z_OK) return NULL; |
|
1126
|
0 |
0 |
if (out_cap < 4096) out_cap = 4096; |
|
1134
|
0 |
0 |
if (*out_len + 4096 > out_cap) { |
|
1136
|
0 |
0 |
if (out_cap > CH_MAX_DECOMPRESS_SIZE) { |
|
1147
|
0 |
0 |
if (ret == Z_STREAM_ERROR || ret == Z_DATA_ERROR || |
|
|
0 |
0 |
if (ret == Z_STREAM_ERROR || ret == Z_DATA_ERROR || |
|
|
0 |
0 |
if (ret == Z_STREAM_ERROR || ret == Z_DATA_ERROR || |
|
1148
|
0 |
0 |
ret == Z_MEM_ERROR || ret == Z_BUF_ERROR) { |
|
1154
|
0 |
0 |
} while (ret != Z_STREAM_END); |
|
1288
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
1293
|
0 |
0 |
if (month <= 2) { year--; month += 9; } else { month -= 3; } |
|
1295
|
0 |
0 |
int era = (year >= 0 ? year : year - 399) / 400; |
|
1308
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
|
0 |
0 |
if (len >= 10 && s[4] == '-' && s[7] == '-') { |
|
1309
|
0 |
0 |
if (len >= 19) { |
|
1337
|
0 |
0 |
while (p < end) { |
|
1339
|
0 |
0 |
if (p + 1 == end && *p == '\n') break; |
|
|
0 |
0 |
if (p + 1 == end && *p == '\n') break; |
|
1344
|
0 |
0 |
while (p <= end) { |
|
1345
|
0 |
0 |
int is_end_of_line = (p == end || *p == '\n'); |
|
|
0 |
0 |
int is_end_of_line = (p == end || *p == '\n'); |
|
1346
|
0 |
0 |
int is_tab = (!is_end_of_line && *p == '\t'); |
|
|
0 |
0 |
int is_tab = (!is_end_of_line && *p == '\t'); |
|
1348
|
0 |
0 |
if (is_end_of_line || is_tab) { |
|
|
0 |
0 |
if (is_end_of_line || is_tab) { |
|
1353
|
0 |
0 |
if (field_len == 2 && field_start[0] == '\\' && field_start[1] == 'N') { |
|
|
0 |
0 |
if (field_len == 2 && field_start[0] == '\\' && field_start[1] == 'N') { |
|
|
0 |
0 |
if (field_len == 2 && field_start[0] == '\\' && field_start[1] == 'N') { |
|
1360
|
0 |
0 |
while (s < s_end) { |
|
1361
|
0 |
0 |
if (*s == '\\' && s + 1 < s_end) { |
|
|
0 |
0 |
if (*s == '\\' && s + 1 < s_end) { |
|
1383
|
0 |
0 |
if (is_tab) { |
|
1387
|
0 |
0 |
if (p < end) p++; /* skip \n */ |
|
1419
|
0 |
0 |
if (do_compress && sql_len > 0) { |
|
|
0 |
0 |
if (do_compress && sql_len > 0) { |
|
1422
|
0 |
0 |
if (body) { |
|
1432
|
0 |
0 |
+ (self->database ? strlen(self->database) * 3 : 0) |
|
1433
|
0 |
0 |
+ (self->session_id ? strlen(self->session_id) * 3 : 0) |
|
1438
|
0 |
0 |
if (self->database) { |
|
1449
|
0 |
0 |
if (self->session_id) { |
|
1461
|
0 |
0 |
if (query_id) { |
|
1463
|
0 |
0 |
if (need > params_cap) { |
|
1473
|
0 |
0 |
+ (self->host ? strlen(self->host) : 0) |
|
1474
|
0 |
0 |
+ (self->user ? strlen(self->user) : 0) |
|
1475
|
0 |
0 |
+ (self->password ? strlen(self->password) : 0); |
|
1486
|
0 |
0 |
if (self->user) { |
|
1490
|
0 |
0 |
if (self->password && self->password[0]) { |
|
|
0 |
0 |
if (self->password && self->password[0]) { |
|
1496
|
0 |
0 |
if (content_encoding) |
|
1499
|
0 |
0 |
if (self->compress) |
|
1506
|
0 |
0 |
if (body_len > 0) { |
|
1507
|
0 |
0 |
if (pos + body_len > req_cap) { |
|
1511
|
0 |
0 |
Copy(body ? body : sql, req + pos, body_len, char); |
|
1515
|
0 |
0 |
if (body) Safefree(body); |
|
1537
|
0 |
0 |
if (do_compress && data_len > 0) { |
|
|
0 |
0 |
if (do_compress && data_len > 0) { |
|
1540
|
0 |
0 |
if (body) { |
|
1557
|
0 |
0 |
+ (self->database ? strlen(self->database) * 3 : 0) |
|
1558
|
0 |
0 |
+ (self->session_id ? strlen(self->session_id) * 3 : 0) |
|
1564
|
0 |
0 |
if (self->database) { |
|
1575
|
0 |
0 |
if (self->session_id) { |
|
1596
|
0 |
0 |
if (query_id) { |
|
1598
|
0 |
0 |
if (need > params_cap) { |
|
1608
|
0 |
0 |
+ (self->host ? strlen(self->host) : 0) |
|
1609
|
0 |
0 |
+ (self->user ? strlen(self->user) : 0) |
|
1610
|
0 |
0 |
+ (self->password ? strlen(self->password) : 0); |
|
1618
|
0 |
0 |
if (self->user) { |
|
1622
|
0 |
0 |
if (self->password && self->password[0]) { |
|
|
0 |
0 |
if (self->password && self->password[0]) { |
|
1628
|
0 |
0 |
if (do_compress) |
|
1631
|
0 |
0 |
if (content_encoding) |
|
1637
|
0 |
0 |
if (body_len > 0) { |
|
1638
|
0 |
0 |
if (pos + body_len > req_cap) { |
|
1642
|
0 |
0 |
Copy(body ? body : data, req + pos, body_len, char); |
|
1646
|
0 |
0 |
if (body) Safefree(body); |
|
1655
|
0 |
0 |
size_t req_cap = 128 + (self->host ? strlen(self->host) : 0); |
|
1664
|
0 |
0 |
if (pos >= req_cap) pos = req_cap - 1; |
|
1674
|
0 |
0 |
if (len < 4) return 0; |
|
1675
|
0 |
0 |
for (i = 0; i <= len - 4; i++) { |
|
1676
|
0 |
0 |
if (buf[i] == '\r' && buf[i+1] == '\n' && |
|
|
0 |
0 |
if (buf[i] == '\r' && buf[i+1] == '\n' && |
|
1677
|
0 |
0 |
buf[i+2] == '\r' && buf[i+3] == '\n') { |
|
|
0 |
0 |
buf[i+2] == '\r' && buf[i+3] == '\n') { |
|
1686
|
0 |
0 |
if (len > 6 && memcmp(body, "Code: ", 6) == 0) |
|
|
0 |
0 |
if (len > 6 && memcmp(body, "Code: ", 6) == 0) |
|
1699
|
0 |
0 |
while (p < end && *p != ' ') p++; |
|
|
0 |
0 |
while (p < end && *p != ' ') p++; |
|
1700
|
0 |
0 |
if (p >= end) return 0; |
|
1704
|
0 |
0 |
if (status < 100 || status > 599) return 500; /* treat malformed as server error */ |
|
|
0 |
0 |
if (status < 100 || status > 599) return 500; /* treat malformed as server error */ |
|
1715
|
0 |
0 |
while (p < end) { |
|
1717
|
0 |
0 |
while (line_end < end && *line_end != '\r') line_end++; |
|
|
0 |
0 |
while (line_end < end && *line_end != '\r') line_end++; |
|
1719
|
0 |
0 |
if ((size_t)(line_end - p) > name_len + 1 && p[name_len] == ':') { |
|
|
0 |
0 |
if ((size_t)(line_end - p) > name_len + 1 && p[name_len] == ':') { |
|
1722
|
0 |
0 |
for (i = 0; i < name_len; i++) { |
|
1723
|
0 |
0 |
if (tolower((unsigned char)p[i]) != tolower((unsigned char)name[i])) { |
|
1728
|
0 |
0 |
if (match) { |
|
1730
|
0 |
0 |
while (val < line_end && *val == ' ') val++; |
|
|
0 |
0 |
while (val < line_end && *val == ' ') val++; |
|
1737
|
0 |
0 |
if (line_end + 2 <= end) p = line_end + 2; |
|
1758
|
0 |
0 |
if (self->recv_len == 0 || self->send_count == 0) return; |
|
|
0 |
0 |
if (self->recv_len == 0 || self->send_count == 0) return; |
|
1762
|
0 |
0 |
if (hdr_end == 0) return; /* need more data */ |
|
1769
|
0 |
0 |
if (val) { |
|
1775
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 7 && strncasecmp(val, "chunked", 7) == 0) { |
|
1781
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
|
0 |
0 |
if (val && val_len >= 4 && strncasecmp(val, "gzip", 4) == 0) { |
|
1785
|
0 |
0 |
if (chunked) { |
|
1792
|
0 |
0 |
while (cp < cp_end) { |
|
1796
|
0 |
0 |
while (nl < cp_end && *nl != '\r') nl++; |
|
|
0 |
0 |
while (nl < cp_end && *nl != '\r') nl++; |
|
1797
|
0 |
0 |
if (nl + 2 > cp_end) goto need_more; /* need more data */ |
|
1802
|
0 |
0 |
if (chunk_size == 0) { |
|
1804
|
0 |
0 |
if (cp + 2 > cp_end) goto need_more; |
|
1810
|
0 |
0 |
if ((size_t)(cp_end - cp) < 2 |
|
1811
|
0 |
0 |
|| chunk_size > (size_t)(cp_end - cp) - 2) goto need_more; |
|
1816
|
0 |
0 |
if (decoded_len + chunk_size < decoded_len |
|
1817
|
0 |
0 |
|| decoded_len + chunk_size > CH_MAX_DECOMPRESS_SIZE) { |
|
1818
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
1821
|
0 |
0 |
if (destroyed) return; |
|
1822
|
0 |
0 |
if (cancel_pending(self, "connection closed")) return; |
|
1826
|
0 |
0 |
if (decoded == NULL) { |
|
1829
|
0 |
0 |
} else if (decoded_len + chunk_size > decoded_cap) { |
|
1838
|
0 |
0 |
if (!chunked_complete) goto need_more; |
|
1846
|
0 |
0 |
if (status == 200) { |
|
1850
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
1853
|
0 |
0 |
if (dec) { |
|
1857
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
1859
|
0 |
0 |
if (consumed < self->recv_len) |
|
1864
|
0 |
0 |
if (destroyed) return; |
|
1873
|
0 |
0 |
if (is_raw) { |
|
1876
|
0 |
0 |
if (final_body != body) Safefree(final_body); |
|
1877
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
1878
|
0 |
0 |
if (consumed < self->recv_len) |
|
1882
|
0 |
0 |
if (destroyed) return; |
|
1885
|
0 |
0 |
if (final_len > 0) |
|
1887
|
0 |
0 |
if (final_body != body) Safefree(final_body); |
|
1888
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
1889
|
0 |
0 |
if (consumed < self->recv_len) |
|
1893
|
0 |
0 |
if (deliver_rows(self, rows)) return; |
|
1902
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
1905
|
0 |
0 |
if (dec) { |
|
1911
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
1917
|
0 |
0 |
if (err_body != body) Safefree(err_body); |
|
1918
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
1921
|
0 |
0 |
if (consumed < self->recv_len) { |
|
1929
|
0 |
0 |
if (destroyed) return; |
|
1933
|
0 |
0 |
if (self->recv_len < hdr_end + content_length) return; /* need more data */ |
|
1939
|
0 |
0 |
if (status == 200) { |
|
1943
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
1946
|
0 |
0 |
if (dec) { |
|
1951
|
0 |
0 |
if (consumed < self->recv_len) |
|
1956
|
0 |
0 |
if (destroyed) return; |
|
1965
|
0 |
0 |
if (is_raw) { |
|
1967
|
0 |
0 |
if (final_body != body) Safefree(final_body); |
|
1968
|
0 |
0 |
if (consumed < self->recv_len) |
|
1972
|
0 |
0 |
if (destroyed) return; |
|
1975
|
0 |
0 |
if (final_len > 0) |
|
1977
|
0 |
0 |
if (final_body != body) Safefree(final_body); |
|
1978
|
0 |
0 |
if (consumed < self->recv_len) |
|
1982
|
0 |
0 |
if (deliver_rows(self, rows)) return; |
|
1990
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
|
0 |
0 |
if (is_gzip && body_len > 0) { |
|
1993
|
0 |
0 |
if (dec) { |
|
1999
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
|
0 |
0 |
while (err_len > 0 && (err_body[err_len-1] == '\n' || err_body[err_len-1] == '\r')) |
|
2006
|
0 |
0 |
if (err_body != body) Safefree(err_body); |
|
2009
|
0 |
0 |
if (consumed < self->recv_len) { |
|
2017
|
0 |
0 |
if (destroyed) return; |
|
2021
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) return; |
|
2025
|
0 |
0 |
if (self->timing) { |
|
2034
|
0 |
0 |
if (decoded) Safefree(decoded); |
|
2049
|
0 |
0 |
nbuf_cstring(&b, self->database ? self->database : "default"); |
|
2050
|
0 |
0 |
nbuf_cstring(&b, self->user ? self->user : "default"); |
|
2051
|
0 |
0 |
nbuf_cstring(&b, self->password ? self->password : ""); |
|
2126
|
0 |
0 |
if (overrides && (svp = hv_fetch(overrides, "query_id", 8, 0))) |
|
|
0 |
0 |
if (overrides && (svp = hv_fetch(overrides, "query_id", 8, 0))) |
|
2128
|
0 |
0 |
else if (defaults && (svp = hv_fetch(defaults, "query_id", 8, 0))) |
|
|
0 |
0 |
else if (defaults && (svp = hv_fetch(defaults, "query_id", 8, 0))) |
|
2134
|
0 |
0 |
if (query_id) { |
|
2202
|
0 |
0 |
if (overrides) { |
|
2205
|
0 |
0 |
while ((pe = hv_iternext(overrides))) { |
|
2210
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) { |
|
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) { |
|
2223
|
0 |
0 |
if (defaults) { |
|
2226
|
0 |
0 |
while ((pe = hv_iternext(defaults))) { |
|
2229
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) { |
|
|
0 |
0 |
if (klen > 6 && memcmp(key, "param_", 6) == 0) { |
|
2230
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
|
0 |
0 |
if (overrides && hv_exists(overrides, key, klen)) |
|
2288
|
0 |
0 |
if (!t) return; |
|
2289
|
0 |
0 |
if (t->inner) free_col_type(t->inner); |
|
2290
|
0 |
0 |
if (t->inners) { |
|
2291
|
0 |
0 |
for (i = 0; i < t->num_inners; i++) |
|
2295
|
0 |
0 |
if (t->type_str) Safefree(t->type_str); |
|
2296
|
0 |
0 |
if (t->tz) Safefree(t->tz); |
|
2313
|
0 |
0 |
for (i = 0; i <= inner_len; i++) { |
|
2314
|
0 |
0 |
if (i < inner_len && inner[i] == '(') depth++; |
|
|
0 |
0 |
if (i < inner_len && inner[i] == '(') depth++; |
|
2315
|
0 |
0 |
else if (i < inner_len && inner[i] == ')') depth--; |
|
|
0 |
0 |
else if (i < inner_len && inner[i] == ')') depth--; |
|
2316
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) |
|
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) |
|
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) |
|
2327
|
0 |
0 |
for (i = 0; i <= inner_len; i++) { |
|
2328
|
0 |
0 |
if (i < inner_len && inner[i] == '(') depth++; |
|
|
0 |
0 |
if (i < inner_len && inner[i] == '(') depth++; |
|
2329
|
0 |
0 |
else if (i < inner_len && inner[i] == ')') depth--; |
|
|
0 |
0 |
else if (i < inner_len && inner[i] == ')') depth--; |
|
2330
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) { |
|
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) { |
|
|
0 |
0 |
else if (i == inner_len || (inner[i] == ',' && depth == 0)) { |
|
2332
|
0 |
0 |
while (s < e && inner[s] == ' ') s++; |
|
|
0 |
0 |
while (s < e && inner[s] == ' ') s++; |
|
2333
|
0 |
0 |
while (e > s && inner[e-1] == ' ') e--; |
|
|
0 |
0 |
while (e > s && inner[e-1] == ' ') e--; |
|
2337
|
0 |
0 |
for (sp = s; sp < e; sp++) { |
|
2338
|
0 |
0 |
if (inner[sp] == '(') break; /* type with parens, stop */ |
|
2339
|
0 |
0 |
if (inner[sp] == ' ') { s = sp + 1; break; } |
|
2352
|
0 |
0 |
if (len == 4 && memcmp(type, "Int8", 4) == 0) t->code = CT_INT8; |
|
|
0 |
0 |
if (len == 4 && memcmp(type, "Int8", 4) == 0) t->code = CT_INT8; |
|
2353
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int16", 5) == 0) t->code = CT_INT16; |
|
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int16", 5) == 0) t->code = CT_INT16; |
|
2354
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int32", 5) == 0) t->code = CT_INT32; |
|
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int32", 5) == 0) t->code = CT_INT32; |
|
2355
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int64", 5) == 0) t->code = CT_INT64; |
|
|
0 |
0 |
else if (len == 5 && memcmp(type, "Int64", 5) == 0) t->code = CT_INT64; |
|
2356
|
0 |
0 |
else if (len == 5 && memcmp(type, "UInt8", 5) == 0) t->code = CT_UINT8; |
|
|
0 |
0 |
else if (len == 5 && memcmp(type, "UInt8", 5) == 0) t->code = CT_UINT8; |
|
2357
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt16", 6) == 0) t->code = CT_UINT16; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt16", 6) == 0) t->code = CT_UINT16; |
|
2358
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt32", 6) == 0) t->code = CT_UINT32; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt32", 6) == 0) t->code = CT_UINT32; |
|
2359
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt64", 6) == 0) t->code = CT_UINT64; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "UInt64", 6) == 0) t->code = CT_UINT64; |
|
2360
|
0 |
0 |
else if (len == 7 && memcmp(type, "Float32", 7) == 0) t->code = CT_FLOAT32; |
|
|
0 |
0 |
else if (len == 7 && memcmp(type, "Float32", 7) == 0) t->code = CT_FLOAT32; |
|
2361
|
0 |
0 |
else if (len == 7 && memcmp(type, "Float64", 7) == 0) t->code = CT_FLOAT64; |
|
|
0 |
0 |
else if (len == 7 && memcmp(type, "Float64", 7) == 0) t->code = CT_FLOAT64; |
|
2362
|
0 |
0 |
else if (len == 6 && memcmp(type, "String", 6) == 0) t->code = CT_STRING; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "String", 6) == 0) t->code = CT_STRING; |
|
2363
|
0 |
0 |
else if (len > 12 && memcmp(type, "FixedString(", 12) == 0) { |
|
|
0 |
0 |
else if (len > 12 && memcmp(type, "FixedString(", 12) == 0) { |
|
2367
|
0 |
0 |
else if (len > 6 && memcmp(type, "Array(", 6) == 0) { |
|
|
0 |
0 |
else if (len > 6 && memcmp(type, "Array(", 6) == 0) { |
|
2371
|
0 |
0 |
else if (len > 9 && memcmp(type, "Nullable(", 9) == 0) { |
|
|
0 |
0 |
else if (len > 9 && memcmp(type, "Nullable(", 9) == 0) { |
|
2375
|
0 |
0 |
else if (len > 15 && memcmp(type, "LowCardinality(", 15) == 0) { |
|
|
0 |
0 |
else if (len > 15 && memcmp(type, "LowCardinality(", 15) == 0) { |
|
2379
|
0 |
0 |
else if (len == 4 && memcmp(type, "Date", 4) == 0) t->code = CT_DATE; |
|
|
0 |
0 |
else if (len == 4 && memcmp(type, "Date", 4) == 0) t->code = CT_DATE; |
|
2380
|
0 |
0 |
else if (len == 6 && memcmp(type, "Date32", 6) == 0) t->code = CT_DATE32; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "Date32", 6) == 0) t->code = CT_DATE32; |
|
2381
|
0 |
0 |
else if (len == 8 && memcmp(type, "DateTime", 8) == 0) t->code = CT_DATETIME; |
|
|
0 |
0 |
else if (len == 8 && memcmp(type, "DateTime", 8) == 0) t->code = CT_DATETIME; |
|
2382
|
0 |
0 |
else if (len > 9 && memcmp(type, "DateTime(", 9) == 0) { |
|
|
0 |
0 |
else if (len > 9 && memcmp(type, "DateTime(", 9) == 0) { |
|
2387
|
0 |
0 |
if (q) { |
|
2389
|
0 |
0 |
if (qe && qe > q + 1) { |
|
|
0 |
0 |
if (qe && qe > q + 1) { |
|
2398
|
0 |
0 |
else if (len > 11 && memcmp(type, "DateTime64(", 11) == 0) { |
|
|
0 |
0 |
else if (len > 11 && memcmp(type, "DateTime64(", 11) == 0) { |
|
2404
|
0 |
0 |
if (comma) { |
|
2406
|
0 |
0 |
if (q) { |
|
2408
|
0 |
0 |
if (qe && qe > q + 1) { |
|
|
0 |
0 |
if (qe && qe > q + 1) { |
|
2418
|
0 |
0 |
else if (len == 4 && memcmp(type, "UUID", 4) == 0) t->code = CT_UUID; |
|
|
0 |
0 |
else if (len == 4 && memcmp(type, "UUID", 4) == 0) t->code = CT_UUID; |
|
2419
|
0 |
0 |
else if (len > 6 && memcmp(type, "Enum8(", 6) == 0) { |
|
|
0 |
0 |
else if (len > 6 && memcmp(type, "Enum8(", 6) == 0) { |
|
2426
|
0 |
0 |
else if (len > 7 && memcmp(type, "Enum16(", 7) == 0) { |
|
|
0 |
0 |
else if (len > 7 && memcmp(type, "Enum16(", 7) == 0) { |
|
2433
|
0 |
0 |
else if (len > 10 && memcmp(type, "Decimal32(", 10) == 0) { |
|
|
0 |
0 |
else if (len > 10 && memcmp(type, "Decimal32(", 10) == 0) { |
|
2437
|
0 |
0 |
else if (len > 10 && memcmp(type, "Decimal64(", 10) == 0) { |
|
|
0 |
0 |
else if (len > 10 && memcmp(type, "Decimal64(", 10) == 0) { |
|
2441
|
0 |
0 |
else if (len > 11 && memcmp(type, "Decimal128(", 11) == 0) { |
|
|
0 |
0 |
else if (len > 11 && memcmp(type, "Decimal128(", 11) == 0) { |
|
2445
|
0 |
0 |
else if (len > 8 && memcmp(type, "Decimal(", 8) == 0) { |
|
|
0 |
0 |
else if (len > 8 && memcmp(type, "Decimal(", 8) == 0) { |
|
2448
|
0 |
0 |
t->param = comma ? atoi(comma + 1) : 0; |
|
2449
|
0 |
0 |
if (precision <= 9) t->code = CT_DECIMAL32; |
|
2450
|
0 |
0 |
else if (precision <= 18) t->code = CT_DECIMAL64; |
|
2453
|
0 |
0 |
else if (len == 7 && memcmp(type, "Nothing", 7) == 0) t->code = CT_NOTHING; |
|
|
0 |
0 |
else if (len == 7 && memcmp(type, "Nothing", 7) == 0) t->code = CT_NOTHING; |
|
2454
|
0 |
0 |
else if (len == 4 && memcmp(type, "Bool", 4) == 0) t->code = CT_BOOL; |
|
|
0 |
0 |
else if (len == 4 && memcmp(type, "Bool", 4) == 0) t->code = CT_BOOL; |
|
2455
|
0 |
0 |
else if (len == 4 && memcmp(type, "IPv4", 4) == 0) t->code = CT_IPV4; |
|
|
0 |
0 |
else if (len == 4 && memcmp(type, "IPv4", 4) == 0) t->code = CT_IPV4; |
|
2456
|
0 |
0 |
else if (len == 4 && memcmp(type, "IPv6", 4) == 0) t->code = CT_IPV6; |
|
|
0 |
0 |
else if (len == 4 && memcmp(type, "IPv6", 4) == 0) t->code = CT_IPV6; |
|
2457
|
0 |
0 |
else if (len == 6 && memcmp(type, "Int128", 6) == 0) t->code = CT_INT128; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "Int128", 6) == 0) t->code = CT_INT128; |
|
2458
|
0 |
0 |
else if (len == 7 && memcmp(type, "UInt128", 7) == 0) t->code = CT_UINT128; |
|
|
0 |
0 |
else if (len == 7 && memcmp(type, "UInt128", 7) == 0) t->code = CT_UINT128; |
|
2459
|
0 |
0 |
else if (len == 6 && memcmp(type, "Int256", 6) == 0) t->code = CT_INT256; |
|
|
0 |
0 |
else if (len == 6 && memcmp(type, "Int256", 6) == 0) t->code = CT_INT256; |
|
2460
|
0 |
0 |
else if (len == 7 && memcmp(type, "UInt256", 7) == 0) t->code = CT_UINT256; |
|
|
0 |
0 |
else if (len == 7 && memcmp(type, "UInt256", 7) == 0) t->code = CT_UINT256; |
|
2461
|
0 |
0 |
else if (len > 6 && memcmp(type, "Tuple(", 6) == 0) { |
|
|
0 |
0 |
else if (len > 6 && memcmp(type, "Tuple(", 6) == 0) { |
|
2465
|
0 |
0 |
else if (len > 4 && memcmp(type, "Map(", 4) == 0) { |
|
|
0 |
0 |
else if (len > 4 && memcmp(type, "Map(", 4) == 0) { |
|
2469
|
0 |
0 |
else if (len > 7 && memcmp(type, "Nested(", 7) == 0) { |
|
|
0 |
0 |
else if (len > 7 && memcmp(type, "Nested(", 7) == 0) { |
|
2478
|
0 |
0 |
else if (len > 25 && memcmp(type, "SimpleAggregateFunction(", 24) == 0) { |
|
|
0 |
0 |
else if (len > 25 && memcmp(type, "SimpleAggregateFunction(", 24) == 0) { |
|
2485
|
0 |
0 |
for (ci = 0; ci < inner_len; ci++) { |
|
2486
|
0 |
0 |
if (inner[ci] == '(') depth++; |
|
2487
|
0 |
0 |
else if (inner[ci] == ')') depth--; |
|
2488
|
0 |
0 |
else if (inner[ci] == ',' && depth == 0) break; |
|
|
0 |
0 |
else if (inner[ci] == ',' && depth == 0) break; |
|
2490
|
0 |
0 |
if (ci < inner_len) { |
|
2493
|
0 |
0 |
while (ci < inner_len && inner[ci] == ' ') ci++; |
|
|
0 |
0 |
while (ci < inner_len && inner[ci] == ' ') ci++; |
|
2533
|
0 |
0 |
if (!gmtime_r(&t, &tm)) return newSVpvn("0000-00-00", 10); |
|
2544
|
0 |
0 |
if (!gmtime_r(&t, &tm)) return newSVpvn("0000-00-00 00:00:00", 19); |
|
2556
|
0 |
0 |
if (!localtime_r(&t, &tm)) return newSVpvn("0000-00-00 00:00:00", 19); |
|
2573
|
0 |
0 |
for (p = 0; p < precision; p++) scale *= 10; |
|
2576
|
0 |
0 |
if (frac < 0) { epoch--; frac += scale; } |
|
2579
|
0 |
0 |
if (use_local) { |
|
2580
|
0 |
0 |
if (!localtime_r(&t, &tm)) return newSVpvn("0000-00-00 00:00:00", 19); |
|
2582
|
0 |
0 |
if (!gmtime_r(&t, &tm)) return newSVpvn("0000-00-00 00:00:00", 19); |
|
2587
|
0 |
0 |
if (precision > 0 && n < 30) { |
|
|
0 |
0 |
if (precision > 0 && n < 30) { |
|
2592
|
0 |
0 |
for (fi = 0; fi < precision && n < 31; fi++) |
|
|
0 |
0 |
for (fi = 0; fi < precision && n < 31; fi++) |
|
2603
|
0 |
0 |
if (old_tz) { |
|
2615
|
0 |
0 |
if (saved) { |
|
2628
|
0 |
0 |
for (i = 0; i < n; i++) r *= 10.0; |
|
2637
|
0 |
0 |
if (!p) return newSViv(code); |
|
2641
|
0 |
0 |
while (p < end) { |
|
2643
|
0 |
0 |
while (p < end && *p == ' ') p++; |
|
|
0 |
0 |
while (p < end && *p == ' ') p++; |
|
2644
|
0 |
0 |
if (p >= end || *p != '\'') break; |
|
|
0 |
0 |
if (p >= end || *p != '\'') break; |
|
2653
|
0 |
0 |
while (p < end && !(*p == '\'' && (p + 1 >= end || *(p+1) != '\''))) { |
|
|
0 |
0 |
while (p < end && !(*p == '\'' && (p + 1 >= end || *(p+1) != '\''))) { |
|
|
0 |
0 |
while (p < end && !(*p == '\'' && (p + 1 >= end || *(p+1) != '\''))) { |
|
|
0 |
0 |
while (p < end && !(*p == '\'' && (p + 1 >= end || *(p+1) != '\''))) { |
|
2654
|
0 |
0 |
if (*p == '\'' && p + 1 < end && *(p+1) == '\'') { p += 2; continue; } |
|
|
0 |
0 |
if (*p == '\'' && p + 1 < end && *(p+1) == '\'') { p += 2; continue; } |
|
|
0 |
0 |
if (*p == '\'' && p + 1 < end && *(p+1) == '\'') { p += 2; continue; } |
|
2658
|
0 |
0 |
if (p < end) p++; /* skip closing quote */ |
|
2661
|
0 |
0 |
while (p < end && (*p == ' ' || *p == '=')) p++; |
|
|
0 |
0 |
while (p < end && (*p == ' ' || *p == '=')) p++; |
|
|
0 |
0 |
while (p < end && (*p == ' ' || *p == '=')) p++; |
|
2666
|
0 |
0 |
if (val == code) return newSVpvn(label_start, label_len); |
|
2669
|
0 |
0 |
while (p < end && *p != ',') p++; |
|
|
0 |
0 |
while (p < end && *p != ',') p++; |
|
2670
|
0 |
0 |
if (p < end) p++; /* skip comma */ |
|
2689
|
0 |
0 |
if (is_signed) { |
|
2693
|
0 |
0 |
uv = neg ? -(unsigned __int128)sv : (unsigned __int128)sv; |
|
2700
|
0 |
0 |
} while (uv); |
|
2701
|
0 |
0 |
if (neg) dbuf[dlen++] = '-'; |
|
2702
|
0 |
0 |
for (k = 0; k < dlen/2; k++) { |
|
2720
|
0 |
0 |
if (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0) |
|
|
0 |
0 |
if (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0) |
|
|
0 |
0 |
if (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0) |
|
|
0 |
0 |
if (v[0] == 0 && v[1] == 0 && v[2] == 0 && v[3] == 0) |
|
2724
|
0 |
0 |
while (v[0] || v[1] || v[2] || v[3]) { |
|
|
0 |
0 |
while (v[0] || v[1] || v[2] || v[3]) { |
|
|
0 |
0 |
while (v[0] || v[1] || v[2] || v[3]) { |
|
|
0 |
0 |
while (v[0] || v[1] || v[2] || v[3]) { |
|
2727
|
0 |
0 |
for (i = 3; i >= 0; i--) { |
|
2745
|
0 |
0 |
for (k = 0; k < dlen/2; k++) { |
|
2752
|
0 |
0 |
if (is_signed && ((unsigned char)p[31] & 0x80)) { |
|
|
0 |
0 |
if (is_signed && ((unsigned char)p[31] & 0x80)) { |
|
2759
|
0 |
0 |
for (i = 0; i < 32; i++) { |
|
2800
|
0 |
0 |
Newxz(out, nrows ? nrows : 1, SV*); |
|
|
0 |
0 |
Newxz(out, nrows ? nrows : 1, SV*); |
|
|
0 |
0 |
Newxz(out, nrows ? nrows : 1, SV*); |
|
2802
|
0 |
0 |
if (ct->code == CT_NOTHING) { |
|
2804
|
0 |
0 |
if (*pos > len || nrows > len - *pos) goto fail; |
|
|
0 |
0 |
if (*pos > len || nrows > len - *pos) goto fail; |
|
2806
|
0 |
0 |
for (i = 0; i < nrows; i++) |
|
2811
|
0 |
0 |
if (ct->code == CT_NULLABLE) { |
|
2815
|
0 |
0 |
if (*pos > len || nrows > len - *pos) goto fail; |
|
|
0 |
0 |
if (*pos > len || nrows > len - *pos) goto fail; |
|
2822
|
0 |
0 |
if (!inner) { Safefree(nulls); goto fail; } |
|
2824
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
2825
|
0 |
0 |
if (nulls[i]) { |
|
2837
|
0 |
0 |
if (ct->code == CT_LOWCARDINALITY) { |
|
2855
|
0 |
0 |
if (*pos + 8 > len) goto fail; |
|
2859
|
0 |
0 |
if (*pos + 8 > len) { *pos = saved; goto fail; } |
|
2866
|
0 |
0 |
if (ser_type & (1ULL << 10)) { |
|
2867
|
0 |
0 |
if (*pos + 8 > len) { *pos = saved; goto fail; } |
|
2871
|
0 |
0 |
if (!dict) { *pos = saved; goto fail; } |
|
2874
|
0 |
0 |
if (lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols |
|
|
0 |
0 |
if (lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols |
|
|
0 |
0 |
if (lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols |
|
2875
|
0 |
0 |
&& lc_self->lc_dicts[lc_col_idx]) { |
|
2880
|
0 |
0 |
if (decode_err) *decode_err = 1; |
|
2887
|
0 |
0 |
if (*pos + 8 > len) { |
|
2888
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
2893
|
0 |
0 |
idx_size = (key_type == 0) ? 1 : (key_type == 1) ? 2 : |
|
|
0 |
0 |
idx_size = (key_type == 0) ? 1 : (key_type == 1) ? 2 : |
|
|
0 |
0 |
idx_size = (key_type == 0) ? 1 : (key_type == 1) ? 2 : |
|
2895
|
0 |
0 |
if (num_indices != nrows) { |
|
2896
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
2897
|
0 |
0 |
*pos = saved; if (decode_err) *decode_err = 1; goto fail; |
|
2899
|
0 |
0 |
if (*pos > len || num_indices > (len - *pos) / idx_size) { |
|
|
0 |
0 |
if (*pos > len || num_indices > (len - *pos) / idx_size) { |
|
2900
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
|
0 |
0 |
if (dict && !dict_borrowed) { for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); Safefree(dict); } |
|
2905
|
0 |
0 |
if (!dict_borrowed && lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols) { |
|
|
0 |
0 |
if (!dict_borrowed && lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols) { |
|
|
0 |
0 |
if (!dict_borrowed && lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols) { |
|
|
0 |
0 |
if (!dict_borrowed && lc_self && lc_col_idx >= 0 && lc_col_idx < lc_self->lc_num_cols) { |
|
2906
|
0 |
0 |
if (lc_self->lc_dicts[lc_col_idx]) { |
|
2908
|
0 |
0 |
for (di = 0; di < lc_self->lc_dict_sizes[lc_col_idx]; di++) |
|
2913
|
0 |
0 |
Newx(dcopy, num_keys > 0 ? num_keys : 1, SV*); |
|
|
0 |
0 |
Newx(dcopy, num_keys > 0 ? num_keys : 1, SV*); |
|
|
0 |
0 |
Newx(dcopy, num_keys > 0 ? num_keys : 1, SV*); |
|
2914
|
0 |
0 |
for (i = 0; i < num_keys; i++) |
|
2920
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
2923
|
0 |
0 |
if (dict && idx < num_keys) { |
|
|
0 |
0 |
if (dict && idx < num_keys) { |
|
2931
|
0 |
0 |
if (dict && !dict_borrowed) { |
|
|
0 |
0 |
if (dict && !dict_borrowed) { |
|
2932
|
0 |
0 |
for (i = 0; i < num_keys; i++) SvREFCNT_dec(dict[i]); |
|
2938
|
0 |
0 |
if (ct->code == CT_STRING) { |
|
2939
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
2942
|
0 |
0 |
if (read_native_string_ref(buf, len, pos, &s, &slen) <= 0) { |
|
2945
|
0 |
0 |
for (j = 0; j < i; j++) SvREFCNT_dec(out[j]); |
|
2953
|
0 |
0 |
if (ct->code == CT_ARRAY) { |
|
2959
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / 8) goto fail; |
|
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / 8) goto fail; |
|
2960
|
0 |
0 |
Newx(offsets, nrows, uint64_t); |
|
2961
|
0 |
0 |
Copy(buf + *pos, offsets, nrows, uint64_t); |
|
2966
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
2967
|
0 |
0 |
if (offsets[i] < prev) { Safefree(offsets); goto fail; } |
|
2971
|
0 |
0 |
total = nrows > 0 ? offsets[nrows - 1] : 0; |
|
2975
|
0 |
0 |
if (!elems) { Safefree(offsets); goto fail; } |
|
2979
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
2983
|
0 |
0 |
if (count > 0) av_extend(av, count - 1); |
|
2984
|
0 |
0 |
for (j = 0; j < count; j++) { |
|
2996
|
0 |
0 |
if (ct->code == CT_TUPLE) { |
|
3002
|
0 |
0 |
for (j = 0; j < ct->num_inners; j++) { |
|
3004
|
0 |
0 |
if (!cols[j]) { |
|
3006
|
0 |
0 |
for (k = 0; k < j; k++) { |
|
3007
|
0 |
0 |
for (i = 0; i < nrows; i++) SvREFCNT_dec(cols[k][i]); |
|
3015
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3018
|
0 |
0 |
for (j = 0; j < ct->num_inners; j++) |
|
3023
|
0 |
0 |
for (j = 0; j < ct->num_inners; j++) Safefree(cols[j]); |
|
3028
|
0 |
0 |
if (ct->code == CT_MAP) { |
|
3029
|
0 |
0 |
if (ct->num_inners != 2) { if (decode_err) *decode_err = 1; goto fail; } |
|
|
0 |
0 |
if (ct->num_inners != 2) { if (decode_err) *decode_err = 1; goto fail; } |
|
3034
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / 8) goto fail; |
|
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / 8) goto fail; |
|
3035
|
0 |
0 |
Newx(offsets, nrows, uint64_t); |
|
3036
|
0 |
0 |
Copy(buf + *pos, offsets, nrows, uint64_t); |
|
3041
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3042
|
0 |
0 |
if (offsets[i] < prev) { Safefree(offsets); goto fail; } |
|
3046
|
0 |
0 |
total = nrows > 0 ? offsets[nrows - 1] : 0; |
|
3049
|
0 |
0 |
if (!keys_col) { Safefree(offsets); goto fail; } |
|
3052
|
0 |
0 |
if (!vals_col) { |
|
3053
|
0 |
0 |
for (i = 0; i < total; i++) SvREFCNT_dec(keys_col[i]); |
|
3060
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3064
|
0 |
0 |
for (j = 0; j < count; j++) { |
|
3069
|
0 |
0 |
if (!hv_store(hv, kstr, klen, val_sv, 0)) |
|
3077
|
0 |
0 |
for (i = 0; i < total; i++) { |
|
3089
|
0 |
0 |
if (ct->code == CT_FIXEDSTRING && fsz == 0) { |
|
|
0 |
0 |
if (ct->code == CT_FIXEDSTRING && fsz == 0) { |
|
3091
|
0 |
0 |
for (i = 0; i < nrows; i++) |
|
3095
|
0 |
0 |
if (fsz > 0) { |
|
3099
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / fsz) goto fail; |
|
|
0 |
0 |
if (*pos > len || nrows > (len - *pos) / fsz) goto fail; |
|
3102
|
0 |
0 |
if (ct->tz && (decode_flags & DECODE_DT_STR) && |
|
|
0 |
0 |
if (ct->tz && (decode_flags & DECODE_DT_STR) && |
|
3103
|
0 |
0 |
(ct->code == CT_DATETIME || ct->code == CT_DATETIME64)) { |
|
|
0 |
0 |
(ct->code == CT_DATETIME || ct->code == CT_DATETIME64)) { |
|
3108
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3123
|
0 |
0 |
if (decode_flags & DECODE_ENUM_STR) |
|
3130
|
0 |
0 |
if (decode_flags & DECODE_ENUM_STR) |
|
3138
|
0 |
0 |
if (decode_flags & DECODE_DT_STR) |
|
3146
|
0 |
0 |
if (decode_flags & DECODE_DT_STR) |
|
3154
|
0 |
0 |
if (decode_flags & DECODE_DT_STR) |
|
3156
|
0 |
0 |
: epoch_to_datetime_sv(v); |
|
3163
|
0 |
0 |
if (decode_flags & DECODE_DT_STR) |
|
3171
|
0 |
0 |
if (decode_flags & DECODE_DEC_SCALE) |
|
3179
|
0 |
0 |
if (decode_flags & DECODE_DEC_SCALE) |
|
3187
|
0 |
0 |
if (decode_flags & DECODE_DEC_SCALE) { |
|
3253
|
0 |
0 |
if (tz_set) restore_tz(saved_tz); |
|
3259
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3262
|
0 |
0 |
if (read_native_string_ref(buf, len, pos, &s, &slen) <= 0) { |
|
3264
|
0 |
0 |
for (j = 0; j < i; j++) SvREFCNT_dec(out[j]); |
|
3281
|
0 |
0 |
for (i = 0; i < src_len; i++) { |
|
3282
|
0 |
0 |
if (src[i] == '\\' && i + 1 < src_len) { |
|
|
0 |
0 |
if (src[i] == '\\' && i + 1 < src_len) { |
|
3303
|
0 |
0 |
return len == 2 && s[0] == '\\' && s[1] == 'N'; |
|
|
0 |
0 |
return len == 2 && s[0] == '\\' && s[1] == 'N'; |
|
|
0 |
0 |
return len == 2 && s[0] == '\\' && s[1] == 'N'; |
|
3309
|
0 |
0 |
for (i = 0; i < len; i++) { |
|
3321
|
0 |
0 |
if (esc) { |
|
3322
|
0 |
0 |
if (i > start) |
|
3330
|
0 |
0 |
if (start < len) |
|
3343
|
0 |
0 |
for (r = 0; r < nrows; r++) { |
|
3348
|
0 |
0 |
if (!row_svp || !SvROK(*row_svp) || |
|
|
0 |
0 |
if (!row_svp || !SvROK(*row_svp) || |
|
3349
|
0 |
0 |
SvTYPE(SvRV(*row_svp)) != SVt_PVAV) { |
|
3356
|
0 |
0 |
for (c = 0; c < ncols; c++) { |
|
3358
|
0 |
0 |
if (c > 0) |
|
3361
|
0 |
0 |
if (!val_svp || !SvOK(*val_svp)) { |
|
|
0 |
0 |
if (!val_svp || !SvOK(*val_svp)) { |
|
3387
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3394
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3401
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3403
|
0 |
0 |
if (ct->code == CT_DATE32 && value_lens[i] >= 10 |
|
|
0 |
0 |
if (ct->code == CT_DATE32 && value_lens[i] >= 10 |
|
3404
|
0 |
0 |
&& values[i][4] == '-') |
|
3413
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3420
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3427
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3429
|
0 |
0 |
if (ct->code == CT_DATE && value_lens[i] >= 10 |
|
|
0 |
0 |
if (ct->code == CT_DATE && value_lens[i] >= 10 |
|
3430
|
0 |
0 |
&& values[i][4] == '-') |
|
3439
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3441
|
0 |
0 |
if (ct->code == CT_DATETIME && value_lens[i] >= 10 |
|
|
0 |
0 |
if (ct->code == CT_DATETIME && value_lens[i] >= 10 |
|
3442
|
0 |
0 |
&& values[i][4] == '-') |
|
3451
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3458
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3465
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3472
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3474
|
0 |
0 |
if (value_lens[i] >= 10 && values[i][4] == '-') { |
|
|
0 |
0 |
if (value_lens[i] >= 10 && values[i][4] == '-') { |
|
3478
|
0 |
0 |
for (s = 0; s < ct->param; s++) v *= 10; |
|
3480
|
0 |
0 |
if (value_lens[i] >= 20 && values[i][19] == '.') { |
|
|
0 |
0 |
if (value_lens[i] >= 20 && values[i][19] == '.') { |
|
3485
|
0 |
0 |
while (fp < fe && digits < prec) { |
|
|
0 |
0 |
while (fp < fe && digits < prec) { |
|
3490
|
0 |
0 |
while (digits < prec) { frac *= 10; digits++; } |
|
3501
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3506
|
0 |
0 |
if (*p == '-') { neg = 1; p++; } |
|
3507
|
0 |
0 |
else if (*p == '+') p++; |
|
3508
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
3509
|
0 |
0 |
if (*p == '.') { |
|
3511
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
3517
|
0 |
0 |
for (s = frac_digits; s < scale; s++) frac_part *= 10; |
|
3518
|
0 |
0 |
for (s = 0; s < scale; s++) integer_part *= 10; |
|
3521
|
0 |
0 |
if (neg) raw = -raw; |
|
3529
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3534
|
0 |
0 |
if (*p == '-') { neg = 1; p++; } |
|
3535
|
0 |
0 |
else if (*p == '+') p++; |
|
3536
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
3537
|
0 |
0 |
if (*p == '.') { |
|
3539
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
3545
|
0 |
0 |
for (s = frac_digits; s < scale; s++) frac_part *= 10; |
|
3546
|
0 |
0 |
for (s = 0; s < scale; s++) integer_part *= 10; |
|
3549
|
0 |
0 |
if (neg) v = -v; |
|
3556
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3557
|
0 |
0 |
if (memchr(values[i], '\\', value_lens[i])) { |
|
3572
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3573
|
0 |
0 |
if (memchr(values[i], '\\', value_lens[i])) { |
|
3587
|
0 |
0 |
if (cplen < fsz) |
|
3597
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3601
|
0 |
0 |
if (slen >= 36) { |
|
3605
|
0 |
0 |
for (j = 0; j < (int)slen && k < 32; j++) { |
|
|
0 |
0 |
for (j = 0; j < (int)slen && k < 32; j++) { |
|
3607
|
0 |
0 |
if (c == '-') continue; |
|
3610
|
0 |
0 |
if (c >= '0' && c <= '9') nibble = c - '0'; |
|
|
0 |
0 |
if (c >= '0' && c <= '9') nibble = c - '0'; |
|
3611
|
0 |
0 |
else if (c >= 'a' && c <= 'f') nibble = 10 + c - 'a'; |
|
|
0 |
0 |
else if (c >= 'a' && c <= 'f') nibble = 10 + c - 'a'; |
|
3612
|
0 |
0 |
else if (c >= 'A' && c <= 'F') nibble = 10 + c - 'A'; |
|
|
0 |
0 |
else if (c >= 'A' && c <= 'F') nibble = 10 + c - 'A'; |
|
3614
|
0 |
0 |
if (k % 2 == 0) raw[k/2] = nibble << 4; |
|
3620
|
0 |
0 |
for (k = 0; k < 8; k++) ubytes[k] = raw[7 - k]; |
|
3621
|
0 |
0 |
for (k = 0; k < 8; k++) ubytes[8 + k] = raw[15 - k]; |
|
3630
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3637
|
0 |
0 |
if (inet_pton(AF_INET, tmp, &addr) == 1) |
|
3644
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3665
|
0 |
0 |
Newxz(inner_vals, nrows, const char *); |
|
3666
|
0 |
0 |
Newx(inner_lens, nrows, size_t); |
|
3668
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3669
|
0 |
0 |
if (is_tsv_null(values[i], value_lens[i])) { |
|
3672
|
0 |
0 |
if (ct->inner->code == CT_STRING || ct->inner->code == CT_FIXEDSTRING) { |
|
|
0 |
0 |
if (ct->inner->code == CT_STRING || ct->inner->code == CT_FIXEDSTRING) { |
|
3704
|
0 |
0 |
if (nrows <= 0xFF) { key_type = 0; idx_size = 1; } |
|
3705
|
0 |
0 |
else if (nrows <= 0xFFFF) { key_type = 1; idx_size = 2; } |
|
3723
|
0 |
0 |
if (!rc) { Safefree(dict_buf.data); return 0; } |
|
3732
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3733
|
0 |
0 |
if (idx_size == 1) { |
|
3736
|
0 |
0 |
} else if (idx_size == 2) { |
|
3763
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3764
|
0 |
0 |
int8_t v = SvIOK(values[i]) ? (int8_t)SvIV(values[i]) |
|
3771
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3772
|
0 |
0 |
int16_t v = SvIOK(values[i]) ? (int16_t)SvIV(values[i]) |
|
3779
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3781
|
0 |
0 |
if (SvIOK(values[i])) { |
|
3786
|
0 |
0 |
if (ct->code == CT_DATE32 && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATE32 && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATE32 && vlen >= 10 && s[4] == '-') |
|
3796
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3798
|
0 |
0 |
: (int64_t)strtoll(SvPV_nolen(values[i]), NULL, 10); |
|
3804
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3805
|
0 |
0 |
uint8_t v = SvIOK(values[i]) ? (uint8_t)SvUV(values[i]) |
|
3812
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3814
|
0 |
0 |
if (SvIOK(values[i])) { |
|
3819
|
0 |
0 |
if (ct->code == CT_DATE && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATE && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATE && vlen >= 10 && s[4] == '-') |
|
3829
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3831
|
0 |
0 |
if (SvIOK(values[i])) { |
|
3836
|
0 |
0 |
if (ct->code == CT_DATETIME && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATETIME && vlen >= 10 && s[4] == '-') |
|
|
0 |
0 |
if (ct->code == CT_DATETIME && vlen >= 10 && s[4] == '-') |
|
3846
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3848
|
0 |
0 |
: (uint64_t)strtoull(SvPV_nolen(values[i]), NULL, 10); |
|
3854
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3856
|
0 |
0 |
: strtof(SvPV_nolen(values[i]), NULL); |
|
3862
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3864
|
0 |
0 |
: strtod(SvPV_nolen(values[i]), NULL); |
|
3870
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3872
|
0 |
0 |
if (SvIOK(values[i])) { |
|
3877
|
0 |
0 |
if (vlen >= 10 && s[4] == '-') { |
|
|
0 |
0 |
if (vlen >= 10 && s[4] == '-') { |
|
3881
|
0 |
0 |
for (sc = 0; sc < ct->param; sc++) v *= 10; |
|
3882
|
0 |
0 |
if (vlen >= 20 && s[19] == '.') { |
|
|
0 |
0 |
if (vlen >= 20 && s[19] == '.') { |
|
3887
|
0 |
0 |
while (fp < fe && digits < prec) { |
|
|
0 |
0 |
while (fp < fe && digits < prec) { |
|
3892
|
0 |
0 |
while (digits < prec) { frac *= 10; digits++; } |
|
3904
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3910
|
0 |
0 |
if (*p == '-') { neg = 1; p++; } |
|
3911
|
0 |
0 |
else if (*p == '+') p++; |
|
3912
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
3913
|
0 |
0 |
if (*p == '.') { |
|
3915
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
3919
|
0 |
0 |
for (s = frac_digits; s < scale; s++) frac_part *= 10; |
|
3920
|
0 |
0 |
for (s = 0; s < scale; s++) integer_part *= 10; |
|
3923
|
0 |
0 |
if (neg) raw = -raw; |
|
3931
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3937
|
0 |
0 |
if (*p == '-') { neg = 1; p++; } |
|
3938
|
0 |
0 |
else if (*p == '+') p++; |
|
3939
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9') { integer_part = integer_part * 10 + (*p - '0'); p++; } |
|
3940
|
0 |
0 |
if (*p == '.') { |
|
3942
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
|
0 |
0 |
while (*p >= '0' && *p <= '9' && frac_digits < scale) { |
|
3946
|
0 |
0 |
for (s = frac_digits; s < scale; s++) frac_part *= 10; |
|
3947
|
0 |
0 |
for (s = 0; s < scale; s++) integer_part *= 10; |
|
3950
|
0 |
0 |
if (neg) v = -v; |
|
3957
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3966
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3972
|
0 |
0 |
if (cplen < fsz) |
|
3979
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
3983
|
0 |
0 |
if (slen >= 36) { |
|
3986
|
0 |
0 |
for (j = 0; j < (int)slen && k < 32; j++) { |
|
|
0 |
0 |
for (j = 0; j < (int)slen && k < 32; j++) { |
|
3988
|
0 |
0 |
if (c == '-') continue; |
|
3991
|
0 |
0 |
if (c >= '0' && c <= '9') nibble = c - '0'; |
|
|
0 |
0 |
if (c >= '0' && c <= '9') nibble = c - '0'; |
|
3992
|
0 |
0 |
else if (c >= 'a' && c <= 'f') nibble = 10 + c - 'a'; |
|
|
0 |
0 |
else if (c >= 'a' && c <= 'f') nibble = 10 + c - 'a'; |
|
3993
|
0 |
0 |
else if (c >= 'A' && c <= 'F') nibble = 10 + c - 'A'; |
|
|
0 |
0 |
else if (c >= 'A' && c <= 'F') nibble = 10 + c - 'A'; |
|
3995
|
0 |
0 |
if (k % 2 == 0) raw[k/2] = nibble << 4; |
|
4000
|
0 |
0 |
for (k = 0; k < 8; k++) ubytes[k] = raw[7 - k]; |
|
4001
|
0 |
0 |
for (k = 0; k < 8; k++) ubytes[8 + k] = raw[15 - k]; |
|
4010
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4019
|
0 |
0 |
if (inet_pton(AF_INET, tmp, &addr) == 1) |
|
4026
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4046
|
0 |
0 |
Newx(inner_vals, nrows ? nrows : 1, SV *); |
|
|
0 |
0 |
Newx(inner_vals, nrows ? nrows : 1, SV *); |
|
|
0 |
0 |
Newx(inner_vals, nrows ? nrows : 1, SV *); |
|
4049
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4050
|
0 |
0 |
if (!SvOK(values[i])) { |
|
4075
|
0 |
0 |
if (nrows <= 0xFF) { key_type = 0; idx_size = 1; } |
|
4076
|
0 |
0 |
else if (nrows <= 0xFFFF) { key_type = 1; idx_size = 2; } |
|
4089
|
0 |
0 |
if (!rc) { Safefree(dict_buf.data); return 0; } |
|
4096
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4097
|
0 |
0 |
if (idx_size == 1) { |
|
4100
|
0 |
0 |
} else if (idx_size == 2) { |
|
4118
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4120
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVAV) |
|
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVAV) |
|
4123
|
0 |
0 |
{ SSize_t cnt = av_len(av) + 1; if (cnt > 0) total += (uint64_t)cnt; } |
|
4126
|
0 |
0 |
Newx(offsets, nrows, uint64_t); |
|
4127
|
0 |
0 |
Newx(all_elems, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_elems, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_elems, total ? total : 1, SV *); |
|
4129
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4132
|
0 |
0 |
for (j = 0; j < n; j++) { |
|
4134
|
0 |
0 |
all_elems[pos++] = ep ? *ep : &PL_sv_undef; |
|
4149
|
0 |
0 |
for (j = 0; j < ct->num_inners; j++) { |
|
4152
|
0 |
0 |
Newx(col_vals, nrows ? nrows : 1, SV *); |
|
|
0 |
0 |
Newx(col_vals, nrows ? nrows : 1, SV *); |
|
|
0 |
0 |
Newx(col_vals, nrows ? nrows : 1, SV *); |
|
4153
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4156
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVAV) { |
|
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVAV) { |
|
4162
|
0 |
0 |
col_vals[i] = ep ? *ep : &PL_sv_undef; |
|
4166
|
0 |
0 |
if (!rc) return 0; |
|
4178
|
0 |
0 |
if (ct->num_inners != 2) return 0; |
|
4180
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4182
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVHV) |
|
|
0 |
0 |
if (!SvROK(values[i]) || SvTYPE(SvRV(values[i])) != SVt_PVHV) |
|
4185
|
0 |
0 |
total += HvUSEDKEYS(hv); |
|
4188
|
0 |
0 |
Newx(offsets, nrows, uint64_t); |
|
4189
|
0 |
0 |
Newx(all_keys, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_keys, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_keys, total ? total : 1, SV *); |
|
4190
|
0 |
0 |
Newx(all_vals, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_vals, total ? total : 1, SV *); |
|
|
0 |
0 |
Newx(all_vals, total ? total : 1, SV *); |
|
4192
|
0 |
0 |
for (i = 0; i < nrows; i++) { |
|
4196
|
0 |
0 |
while ((he = hv_iternext(hv))) { |
|
4206
|
0 |
0 |
if (rc) rc = encode_column_sv(aTHX_ b, all_vals, total, ct->inners[1]); |
|
4279
|
0 |
0 |
while (p < end) { |
|
4281
|
0 |
0 |
const char *line_limit = line_end ? line_end : end; |
|
4285
|
0 |
0 |
if (p == line_limit) { p = line_limit + 1; continue; } |
|
4287
|
0 |
0 |
if (nrows >= max_rows) { |
|
4288
|
0 |
0 |
if (max_rows > INT_MAX / 2 || |
|
|
0 |
0 |
if (max_rows > INT_MAX / 2 || |
|
4289
|
0 |
0 |
(num_cols > 0 && max_rows * 2 > INT_MAX / num_cols)) { |
|
4303
|
0 |
0 |
for (col = 0; col < num_cols; col++) { |
|
4305
|
0 |
0 |
if (fp > line_limit) fp = line_limit; |
|
4306
|
0 |
0 |
if (col < num_cols - 1) { |
|
4308
|
0 |
0 |
if (!tab) tab = line_limit; |
|
4321
|
0 |
0 |
if (nrows == 0) { |
|
4348
|
0 |
0 |
for (col = 0; col < num_cols; col++) { |
|
4361
|
0 |
0 |
for (row = 0; row < nrows; row++) { |
|
4366
|
0 |
0 |
if (!encode_column_text(&body, col_vals, col_vlens, |
|
4385
|
0 |
0 |
if (!result) { *out_len = 0; return NULL; } |
|
4406
|
0 |
0 |
if (nrows <= 0) { |
|
4426
|
0 |
0 |
for (col = 0; col < num_cols; col++) { |
|
4435
|
0 |
0 |
Newx(col_vals, nrows, SV *); |
|
4436
|
0 |
0 |
for (row = 0; row < nrows; row++) { |
|
4441
|
0 |
0 |
if (!row_svp || !SvROK(*row_svp) || SvTYPE(SvRV(*row_svp)) != SVt_PVAV) { |
|
|
0 |
0 |
if (!row_svp || !SvROK(*row_svp) || SvTYPE(SvRV(*row_svp)) != SVt_PVAV) { |
|
|
0 |
0 |
if (!row_svp || !SvROK(*row_svp) || SvTYPE(SvRV(*row_svp)) != SVt_PVAV) { |
|
4449
|
0 |
0 |
col_vals[row] = (val_svp && *val_svp) ? *val_svp : &PL_sv_undef; |
|
|
0 |
0 |
col_vals[row] = (val_svp && *val_svp) ? *val_svp : &PL_sv_undef; |
|
4452
|
0 |
0 |
if (!encode_column_sv(aTHX_ &body, col_vals, (uint64_t)nrows, col_types[col])) { |
|
4463
|
0 |
0 |
if (!result) { *out_len = 0; return NULL; } |
|
4478
|
0 |
0 |
if (rc == 0) return 0; |
|
4479
|
0 |
0 |
if (rc < 0) return -1; |
|
4480
|
0 |
0 |
if (field_num == 0) return 1; /* end marker */ |
|
4481
|
0 |
0 |
if (field_num == 1) { |
|
4485
|
0 |
0 |
if (rc <= 0) return rc; |
|
4486
|
0 |
0 |
} else if (field_num == 2) { |
|
4490
|
0 |
0 |
if (rc <= 0) return rc; |
|
4515
|
0 |
0 |
if (rc == 0) return 0; |
|
4516
|
0 |
0 |
if (rc < 0) { |
|
4529
|
0 |
0 |
if (rc == 0) return 0; |
|
4530
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed server name"); return -1; } |
|
4533
|
0 |
0 |
if (rc == 0) { Safefree(sname); return 0; } |
|
4534
|
0 |
0 |
if (rc < 0) { Safefree(sname); *errmsg = safe_strdup("malformed server version major"); return -1; } |
|
4537
|
0 |
0 |
if (rc == 0) { Safefree(sname); return 0; } |
|
4538
|
0 |
0 |
if (rc < 0) { Safefree(sname); *errmsg = safe_strdup("malformed server version minor"); return -1; } |
|
4541
|
0 |
0 |
if (rc == 0) { Safefree(sname); return 0; } |
|
4542
|
0 |
0 |
if (rc < 0) { Safefree(sname); *errmsg = safe_strdup("malformed server revision"); return -1; } |
|
4544
|
0 |
0 |
if (self->server_name) Safefree(self->server_name); |
|
4554
|
0 |
0 |
if (rc == 0) return 0; |
|
4555
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed timezone"); return -1; } |
|
4556
|
0 |
0 |
if (self->server_timezone) Safefree(self->server_timezone); |
|
4564
|
0 |
0 |
if (rc == 0) return 0; |
|
4565
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed display name"); return -1; } |
|
4566
|
0 |
0 |
if (self->server_display_name) Safefree(self->server_display_name); |
|
4574
|
0 |
0 |
if (rc == 0) return 0; |
|
4575
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed version patch"); return -1; } |
|
4580
|
0 |
0 |
if (pos < self->recv_len) { |
|
4598
|
0 |
0 |
if (rc == 0) return 0; |
|
4599
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed table name"); return -1; } |
|
4665
|
0 |
0 |
if (rc == 0) { |
|
4666
|
0 |
0 |
if (decompressed) { Safefree(decompressed); *errmsg = safe_strdup("truncated compressed block"); return -1; } |
|
4669
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed block info"); return -1; } |
|
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed block info"); return -1; } |
|
4673
|
0 |
0 |
if (rc == 0) { |
|
4674
|
0 |
0 |
if (decompressed) { Safefree(decompressed); *errmsg = safe_strdup("truncated compressed block"); return -1; } |
|
4677
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed num_cols"); return -1; } |
|
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed num_cols"); return -1; } |
|
4680
|
0 |
0 |
if (rc == 0) { |
|
4681
|
0 |
0 |
if (decompressed) { Safefree(decompressed); *errmsg = safe_strdup("truncated compressed block"); return -1; } |
|
4684
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed num_rows"); return -1; } |
|
|
0 |
0 |
if (rc < 0) { if (decompressed) Safefree(decompressed); *errmsg = safe_strdup("malformed num_rows"); return -1; } |
|
4687
|
0 |
0 |
if (num_rows == 0) { |
|
4689
|
0 |
0 |
if (self->native_state == NATIVE_WAIT_INSERT_META |
|
4690
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols > 0) { |
|
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols > 0) { |
|
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols > 0) { |
|
4700
|
0 |
0 |
Newxz(cnames, num_cols, const char *); |
|
4701
|
0 |
0 |
Newxz(cname_lens, num_cols, size_t); |
|
4702
|
0 |
0 |
Newxz(ctypes_str, num_cols, const char *); |
|
4703
|
0 |
0 |
Newxz(ctype_lens, num_cols, size_t); |
|
4704
|
0 |
0 |
Newxz(ctypes, num_cols, col_type_t *); |
|
4706
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
4710
|
0 |
0 |
if (rc <= 0) { |
|
4711
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
4715
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4716
|
0 |
0 |
if (rc < 0 || decompressed) { *errmsg = safe_strdup("malformed cname"); return -1; } |
|
|
0 |
0 |
if (rc < 0 || decompressed) { *errmsg = safe_strdup("malformed cname"); return -1; } |
|
4721
|
0 |
0 |
if (rc <= 0) { |
|
4722
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
4726
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4727
|
0 |
0 |
if (rc < 0 || decompressed) { *errmsg = safe_strdup("malformed ctype"); return -1; } |
|
|
0 |
0 |
if (rc < 0 || decompressed) { *errmsg = safe_strdup("malformed ctype"); return -1; } |
|
4733
|
0 |
0 |
if (dpos >= dlen) { |
|
4734
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
4738
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4739
|
0 |
0 |
if (decompressed) { *errmsg = safe_strdup("truncated custom_ser"); return -1; } |
|
4742
|
0 |
0 |
if ((uint8_t)dbuf[dpos]) { |
|
4743
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
|
0 |
0 |
for (c = 0; c < num_cols; c++) if (ctypes[c]) free_col_type(ctypes[c]); |
|
4747
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4755
|
0 |
0 |
if (self->insert_av) { |
|
4767
|
0 |
0 |
for (c = 0; c < num_cols; c++) |
|
4775
|
0 |
0 |
int encode_failed = (!data_pkt && data_pkt_len == (size_t)-1); |
|
|
0 |
0 |
int encode_failed = (!data_pkt && data_pkt_len == (size_t)-1); |
|
4778
|
0 |
0 |
if (self->insert_data) { |
|
4783
|
0 |
0 |
if (self->insert_av) { |
|
4788
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4790
|
0 |
0 |
if (pos < self->recv_len) { |
|
4796
|
0 |
0 |
if (!data_pkt) { |
|
4803
|
0 |
0 |
if (encode_failed) |
|
4816
|
0 |
0 |
if (try_write(self)) return -2; |
|
4822
|
0 |
0 |
if (self->native_state == NATIVE_WAIT_INSERT_META |
|
4823
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols == 0) { |
|
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols == 0) { |
|
|
0 |
0 |
&& (self->insert_data || self->insert_av) && num_cols == 0) { |
|
4826
|
0 |
0 |
if (self->insert_data) { |
|
4831
|
0 |
0 |
if (self->insert_av) { |
|
4836
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4838
|
0 |
0 |
if (pos < self->recv_len) { |
|
4854
|
0 |
0 |
if (try_write(self)) return -2; |
|
4861
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
4862
|
0 |
0 |
if (skip_native_string(dbuf, dlen, &dpos) <= 0) { |
|
4863
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4866
|
0 |
0 |
if (skip_native_string(dbuf, dlen, &dpos) <= 0) { |
|
4867
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4871
|
0 |
0 |
if (dpos >= dlen) { |
|
4872
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4875
|
0 |
0 |
if ((uint8_t)dbuf[dpos]) { |
|
4876
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4883
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
4885
|
0 |
0 |
if (pos < self->recv_len) { |
|
4902
|
0 |
0 |
Newxz(columns, num_cols, SV**); |
|
4903
|
0 |
0 |
Newxz(col_types, num_cols, col_type_t*); |
|
4904
|
0 |
0 |
if (named) { |
|
4905
|
0 |
0 |
Newxz(cnames, num_cols, const char *); |
|
4906
|
0 |
0 |
Newx(cname_lens, num_cols, size_t); |
|
4909
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
4917
|
0 |
0 |
if (rc == 0) { |
|
4918
|
0 |
0 |
if (decompressed) { *errmsg = safe_strdup("truncated cname"); goto data_error; } |
|
4921
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed cname"); goto data_error; } |
|
4923
|
0 |
0 |
if (named) { |
|
4929
|
0 |
0 |
if (c == 0 && !self->native_rows && self->native_col_names) { |
|
|
0 |
0 |
if (c == 0 && !self->native_rows && self->native_col_names) { |
|
|
0 |
0 |
if (c == 0 && !self->native_rows && self->native_col_names) { |
|
4932
|
0 |
0 |
if (self->native_col_types) { |
|
4937
|
0 |
0 |
if (!self->native_col_names) { |
|
4938
|
0 |
0 |
if (c == 0) { |
|
4943
|
0 |
0 |
if (self->native_col_names && av_len(self->native_col_names) + 1 < (SSize_t)num_cols) |
|
|
0 |
0 |
if (self->native_col_names && av_len(self->native_col_names) + 1 < (SSize_t)num_cols) |
|
4947
|
0 |
0 |
if (rc == 0) { |
|
4948
|
0 |
0 |
if (decompressed) { *errmsg = safe_strdup("truncated ctype"); goto data_error; } |
|
4951
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed ctype"); goto data_error; } |
|
4954
|
0 |
0 |
if (self->native_col_types && av_len(self->native_col_types) + 1 < (SSize_t)num_cols) |
|
|
0 |
0 |
if (self->native_col_types && av_len(self->native_col_types) + 1 < (SSize_t)num_cols) |
|
4958
|
0 |
0 |
if (dpos >= dlen) { |
|
4959
|
0 |
0 |
if (decompressed) { *errmsg = safe_strdup("truncated custom_ser"); goto data_error; } |
|
4962
|
0 |
0 |
if ((uint8_t)dbuf[dpos]) { |
|
4969
|
0 |
0 |
if (c == 0 && !self->lc_dicts && num_cols > 0) { |
|
|
0 |
0 |
if (c == 0 && !self->lc_dicts && num_cols > 0) { |
|
|
0 |
0 |
if (c == 0 && !self->lc_dicts && num_cols > 0) { |
|
4970
|
0 |
0 |
Newxz(self->lc_dicts, num_cols, SV**); |
|
4971
|
0 |
0 |
Newxz(self->lc_dict_sizes, num_cols, uint64_t); |
|
4978
|
0 |
0 |
if (!columns[c]) { |
|
4979
|
0 |
0 |
if (col_err || decompressed) { |
|
|
0 |
0 |
if (col_err || decompressed) { |
|
4991
|
0 |
0 |
if (ptype == SERVER_TOTALS) { |
|
4992
|
0 |
0 |
if (!self->native_totals) self->native_totals = newAV(); |
|
4994
|
0 |
0 |
} else if (ptype == SERVER_EXTREMES) { |
|
4995
|
0 |
0 |
if (!self->native_extremes) self->native_extremes = newAV(); |
|
4998
|
0 |
0 |
if (!self->native_rows) self->native_rows = newAV(); |
|
5002
|
0 |
0 |
if (named) { |
|
5003
|
0 |
0 |
for (r = 0; r < num_rows; r++) { |
|
5005
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
5006
|
0 |
0 |
if (!hv_store(hv, cnames[c], cname_lens[c], columns[c][r], 0)) |
|
5012
|
0 |
0 |
for (r = 0; r < num_rows; r++) { |
|
5014
|
0 |
0 |
if (num_cols > 0) |
|
5016
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
5026
|
0 |
0 |
SV *on_data = (ptype == SERVER_DATA) ? peek_cb_on_data(self) : NULL; |
|
5027
|
0 |
0 |
if (on_data && self->native_rows) { |
|
|
0 |
0 |
if (on_data && self->native_rows) { |
|
5032
|
0 |
0 |
PUSHMARK(SP); |
|
5036
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
5037
|
0 |
0 |
warn("EV::ClickHouse: exception in on_data handler: %s", |
|
5039
|
0 |
0 |
FREETMPS; LEAVE; |
|
5045
|
0 |
0 |
if (check_destroyed(self)) { |
|
5046
|
0 |
0 |
if (cnames) Safefree(cnames); |
|
5047
|
0 |
0 |
if (cname_lens) Safefree(cname_lens); |
|
5048
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
5053
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
5060
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
5066
|
0 |
0 |
if (cnames) Safefree(cnames); |
|
5067
|
0 |
0 |
if (cname_lens) Safefree(cname_lens); |
|
5068
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
5072
|
0 |
0 |
if (pos < self->recv_len) { |
|
5082
|
0 |
0 |
for (c = 0; c < num_cols; c++) { |
|
5083
|
0 |
0 |
if (columns[c]) { |
|
5085
|
0 |
0 |
for (j = 0; j < num_rows; j++) { |
|
5086
|
0 |
0 |
if (columns[c][j]) SvREFCNT_dec(columns[c][j]); |
|
5090
|
0 |
0 |
if (col_types[c]) free_col_type(col_types[c]); |
|
5094
|
0 |
0 |
if (cnames) Safefree(cnames); |
|
5095
|
0 |
0 |
if (cname_lens) Safefree(cname_lens); |
|
5096
|
0 |
0 |
if (decompressed) Safefree(decompressed); |
|
5097
|
0 |
0 |
if (*errmsg) { |
|
5117
|
0 |
0 |
if (rc == 0) return 0; |
|
5118
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed exception code"); return -1; } |
|
5121
|
0 |
0 |
if (rc == 0) return 0; |
|
5122
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed exception name"); return -1; } |
|
5125
|
0 |
0 |
if (rc == 0) return 0; |
|
5126
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed exception message"); return -1; } |
|
5129
|
0 |
0 |
if (rc == 0) return 0; |
|
5130
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed exception stack"); return -1; } |
|
5133
|
0 |
0 |
if (rc == 0) return 0; |
|
5134
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed exception has_nested"); return -1; } |
|
5137
|
0 |
0 |
while (has_nested) { |
|
5139
|
0 |
0 |
if (rc == 0) return 0; |
|
5140
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed nested exception"); return -1; } |
|
5143
|
0 |
0 |
if (rc == 0) return 0; |
|
5144
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed nested exception"); return -1; } |
|
5147
|
0 |
0 |
if (rc == 0) return 0; |
|
5148
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed nested exception"); return -1; } |
|
5151
|
0 |
0 |
if (rc == 0) return 0; |
|
5152
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed nested exception"); return -1; } |
|
5155
|
0 |
0 |
if (rc == 0) return 0; |
|
5156
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed nested exception"); return -1; } |
|
5165
|
0 |
0 |
if (pos < self->recv_len) { |
|
5181
|
0 |
0 |
if (rc == 0) return 0; |
|
5182
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed progress packet"); return -1; } |
|
5185
|
0 |
0 |
if (rc == 0) return 0; |
|
5186
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed progress packet"); return -1; } |
|
5189
|
0 |
0 |
if (rc == 0) return 0; |
|
5190
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed progress packet"); return -1; } |
|
5194
|
0 |
0 |
if (rc == 0) return 0; |
|
5195
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed progress packet"); return -1; } |
|
5198
|
0 |
0 |
if (rc == 0) return 0; |
|
5199
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed progress packet"); return -1; } |
|
5202
|
0 |
0 |
if (pos < self->recv_len) { |
|
5208
|
0 |
0 |
if (NULL != self->on_progress) { |
|
5212
|
0 |
0 |
PUSHMARK(SP); |
|
5213
|
0 |
0 |
EXTEND(SP, 5); |
|
5221
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
5222
|
0 |
0 |
warn("EV::ClickHouse: exception in progress handler: %s", |
|
5224
|
0 |
0 |
FREETMPS; LEAVE; |
|
5226
|
0 |
0 |
if (check_destroyed(self)) return -2; /* destroyed */ |
|
5237
|
0 |
0 |
if (rc == 0) return 0; |
|
5238
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5240
|
0 |
0 |
if (rc == 0) return 0; |
|
5241
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5243
|
0 |
0 |
if (rc == 0) return 0; |
|
5244
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5246
|
0 |
0 |
if (rc == 0) return 0; |
|
5247
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5249
|
0 |
0 |
if (rc == 0) return 0; |
|
5250
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5252
|
0 |
0 |
if (rc == 0) return 0; |
|
5253
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_info packet"); return -1; } |
|
5258
|
0 |
0 |
if (pos < self->recv_len) { |
|
5269
|
0 |
0 |
if (rc == 0) return 0; |
|
5270
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed table_columns packet"); return -1; } |
|
5272
|
0 |
0 |
if (rc == 0) return 0; |
|
5273
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed table_columns packet"); return -1; } |
|
5274
|
0 |
0 |
if (pos < self->recv_len) { |
|
5290
|
0 |
0 |
if (rc == 0) return 0; |
|
5291
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed server log block"); return -1; } |
|
5346
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
5350
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
5352
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
5354
|
0 |
0 |
if (nc > 0) { |
|
5356
|
0 |
0 |
for (c = 0; c < nc; c++) { |
|
5360
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
5362
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (log_decompressed) Safefree(log_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed server log block"); return rc; } |
|
5364
|
0 |
0 |
if (lpos >= llen) { if (log_decompressed) Safefree(log_decompressed); return 0; } |
|
|
0 |
0 |
if (lpos >= llen) { if (log_decompressed) Safefree(log_decompressed); return 0; } |
|
5365
|
0 |
0 |
if ((uint8_t)lbuf[lpos]) { if (log_decompressed) Safefree(log_decompressed); *errmsg = safe_strdup("custom serialization not supported"); return -1; } |
|
|
0 |
0 |
if ((uint8_t)lbuf[lpos]) { if (log_decompressed) Safefree(log_decompressed); *errmsg = safe_strdup("custom serialization not supported"); return -1; } |
|
5367
|
0 |
0 |
if (nr > 0) { |
|
5371
|
0 |
0 |
if (!vals) { |
|
5373
|
0 |
0 |
if (log_col_err || log_decompressed) { |
|
|
0 |
0 |
if (log_col_err || log_decompressed) { |
|
5374
|
0 |
0 |
if (log_decompressed) Safefree(log_decompressed); |
|
5381
|
0 |
0 |
for (j = 0; j < nr; j++) SvREFCNT_dec(vals[j]); |
|
5388
|
0 |
0 |
if (!log_decompressed) pos = lpos; |
|
5389
|
0 |
0 |
if (log_decompressed) Safefree(log_decompressed); |
|
5391
|
0 |
0 |
if (pos < self->recv_len) { |
|
5409
|
0 |
0 |
if (rc == 0) return 0; |
|
5410
|
0 |
0 |
if (rc < 0) { *errmsg = safe_strdup("malformed profile_events block"); return -1; } |
|
5461
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
5465
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
5467
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
5469
|
0 |
0 |
if (pe_nc > 0) { |
|
5471
|
0 |
0 |
for (c = 0; c < pe_nc; c++) { |
|
5475
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
5477
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
|
0 |
0 |
if (rc <= 0) { if (pe_decompressed) Safefree(pe_decompressed); if (rc < 0) *errmsg = safe_strdup("malformed profile_events block"); return rc; } |
|
5479
|
0 |
0 |
if (pepos >= pelen) { if (pe_decompressed) Safefree(pe_decompressed); return 0; } |
|
|
0 |
0 |
if (pepos >= pelen) { if (pe_decompressed) Safefree(pe_decompressed); return 0; } |
|
5480
|
0 |
0 |
if ((uint8_t)pebuf[pepos]) { if (pe_decompressed) Safefree(pe_decompressed); *errmsg = safe_strdup("custom serialization not supported"); return -1; } |
|
|
0 |
0 |
if ((uint8_t)pebuf[pepos]) { if (pe_decompressed) Safefree(pe_decompressed); *errmsg = safe_strdup("custom serialization not supported"); return -1; } |
|
5482
|
0 |
0 |
if (pe_nr > 0) { |
|
5486
|
0 |
0 |
if (!vals) { |
|
5488
|
0 |
0 |
if (pe_col_err || pe_decompressed) { |
|
|
0 |
0 |
if (pe_col_err || pe_decompressed) { |
|
5489
|
0 |
0 |
if (pe_decompressed) Safefree(pe_decompressed); |
|
5496
|
0 |
0 |
for (j = 0; j < pe_nr; j++) SvREFCNT_dec(vals[j]); |
|
5503
|
0 |
0 |
if (!pe_decompressed) pos = pepos; |
|
5504
|
0 |
0 |
if (pe_decompressed) Safefree(pe_decompressed); |
|
5506
|
0 |
0 |
if (pos < self->recv_len) { |
|
5515
|
0 |
0 |
if (pos < self->recv_len) { |
|
5523
|
0 |
0 |
if (pos < self->recv_len) { |
|
5547
|
0 |
0 |
while (self->recv_len > 0 && self->magic == EV_CH_MAGIC) { |
|
|
0 |
0 |
while (self->recv_len > 0 && self->magic == EV_CH_MAGIC) { |
|
5552
|
0 |
0 |
if (rc == 0) { |
|
5557
|
0 |
0 |
if (rc == -2) { |
|
5562
|
0 |
0 |
if (rc == 4) { |
|
5564
|
0 |
0 |
if (self->native_state == NATIVE_WAIT_HELLO) { |
|
5566
|
0 |
0 |
if (self->server_revision >= DBMS_MIN_PROTOCOL_VERSION_WITH_ADDENDUM) { |
|
5575
|
0 |
0 |
if (try_write(self)) return; |
|
5581
|
0 |
0 |
if (NULL != self->on_connect) { |
|
5587
|
0 |
0 |
PUSHMARK(SP); |
|
5590
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
5591
|
0 |
0 |
warn("EV::ClickHouse: exception in connect handler: %s", |
|
5594
|
0 |
0 |
FREETMPS; |
|
5598
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5601
|
0 |
0 |
if (!ngx_queue_empty(&self->send_queue)) |
|
5609
|
0 |
0 |
if (rc == -1) { |
|
5611
|
0 |
0 |
if (self->native_state == NATIVE_WAIT_HELLO) { |
|
5617
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5618
|
0 |
0 |
if (cancel_pending(self, "connection failed")) return; |
|
5624
|
0 |
0 |
if (self->timing) { |
|
5630
|
0 |
0 |
if (self->native_rows) { |
|
5634
|
0 |
0 |
if (self->insert_data) { |
|
5639
|
0 |
0 |
if (self->insert_av) { |
|
5643
|
0 |
0 |
if (self->insert_err) { |
|
5649
|
0 |
0 |
if (self->send_count > 0) self->send_count--; |
|
5653
|
0 |
0 |
if (destroyed) return; |
|
5660
|
0 |
0 |
if (rc == 2) { |
|
5662
|
0 |
0 |
if (self->timing) { |
|
5667
|
0 |
0 |
if (self->send_count > 0) self->send_count--; |
|
5670
|
0 |
0 |
if (self->insert_err) { |
|
5673
|
0 |
0 |
if (self->native_rows) { |
|
5679
|
0 |
0 |
if (destroyed) return; |
|
5683
|
0 |
0 |
if (deliver_rows(self, rows)) return; |
|
5691
|
0 |
0 |
if (rc == 3) { |
|
5693
|
0 |
0 |
if (self->timing) { |
|
5698
|
0 |
0 |
if (self->send_count > 0) self->send_count--; |
|
5700
|
0 |
0 |
if (deliver_rows(self, rows)) return; |
|
5718
|
0 |
0 |
self->protocol == PROTO_NATIVE ? "native" : "http"); |
|
5726
|
0 |
0 |
if (ret != 0) { |
|
5732
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5733
|
0 |
0 |
if (cancel_pending(self, errbuf)) return; |
|
5739
|
0 |
0 |
if (fd < 0) { |
|
5744
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5745
|
0 |
0 |
if (cancel_pending(self, "socket() failed")) return; |
|
5753
|
0 |
0 |
if (fl < 0 || fcntl(fd, F_SETFL, fl | O_NONBLOCK) < 0) { |
|
|
0 |
0 |
if (fl < 0 || fcntl(fd, F_SETFL, fl | O_NONBLOCK) < 0) { |
|
5759
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5760
|
0 |
0 |
if (cancel_pending(self, "fcntl O_NONBLOCK failed")) return; |
|
5778
|
0 |
0 |
if (ret == 0) { |
|
5782
|
0 |
0 |
if (self->protocol != PROTO_NATIVE && !self->tls_enabled) |
|
|
0 |
0 |
if (self->protocol != PROTO_NATIVE && !self->tls_enabled) |
|
5792
|
0 |
0 |
if (errno != EINPROGRESS) { |
|
5801
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5802
|
0 |
0 |
if (cancel_pending(self, errbuf)) return; |
|
5815
|
0 |
0 |
if (self->connect_timeout > 0) { |
|
5827
|
0 |
0 |
if (self->timing) { |
|
5833
|
0 |
0 |
if (self->tls_enabled) { |
|
5836
|
0 |
0 |
if (!self->ssl_ctx) { |
|
5840
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5841
|
0 |
0 |
if (cancel_pending(self, "SSL_CTX_new failed")) return; |
|
5846
|
0 |
0 |
if (self->tls_skip_verify) |
|
5850
|
0 |
0 |
if (self->tls_ca_file) { |
|
5851
|
0 |
0 |
if (SSL_CTX_load_verify_locations(self->ssl_ctx, self->tls_ca_file, NULL) != 1) { |
|
5855
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5856
|
0 |
0 |
if (cancel_pending(self, "SSL_CTX_load_verify_locations failed")) return; |
|
5862
|
0 |
0 |
if (!self->ssl) { |
|
5866
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5867
|
0 |
0 |
if (cancel_pending(self, "SSL_new failed")) return; |
|
5874
|
0 |
0 |
if (!is_ip_literal(self->host)) |
|
5878
|
0 |
0 |
if (!self->tls_skip_verify) { |
|
5881
|
0 |
0 |
if (is_ip_literal(self->host)) |
|
5888
|
0 |
0 |
if (ret == 1) { |
|
5893
|
0 |
0 |
if (err == SSL_ERROR_WANT_READ) { |
|
5895
|
0 |
0 |
} else if (err == SSL_ERROR_WANT_WRITE) { |
|
5901
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5902
|
0 |
0 |
if (cancel_pending(self, "SSL_connect failed")) return; |
|
5913
|
0 |
0 |
if (self->protocol == PROTO_NATIVE) { |
|
5931
|
0 |
0 |
if (NULL != self->on_connect) { |
|
5937
|
0 |
0 |
PUSHMARK(SP); |
|
5940
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
5941
|
0 |
0 |
warn("EV::ClickHouse: exception in connect handler: %s", SvPV_nolen(ERRSV)); |
|
5943
|
0 |
0 |
FREETMPS; |
|
5947
|
0 |
0 |
if (check_destroyed(self)) return; |
|
5951
|
0 |
0 |
if (!ngx_queue_empty(&self->send_queue)) |
|
5959
|
0 |
0 |
while (self->send_pos < self->send_len) { |
|
5962
|
0 |
0 |
if (n < 0) { |
|
5963
|
0 |
0 |
if (errno == EAGAIN || errno == EWOULDBLOCK) { |
|
|
0 |
0 |
if (errno == EAGAIN || errno == EWOULDBLOCK) { |
|
5971
|
0 |
0 |
if (check_destroyed(self)) return 1; |
|
5972
|
0 |
0 |
if (cancel_pending(self, "write error")) return 1; |
|
5976
|
0 |
0 |
if (n == 0) { |
|
5980
|
0 |
0 |
if (check_destroyed(self)) return 1; |
|
5981
|
0 |
0 |
if (cancel_pending(self, "connection closed")) return 1; |
|
5997
|
0 |
0 |
if (!ngx_queue_empty(&self->send_queue)) |
|
6009
|
0 |
0 |
if (n < 0) { |
|
6010
|
0 |
0 |
if (errno == EAGAIN || errno == EWOULDBLOCK) return; |
|
|
0 |
0 |
if (errno == EAGAIN || errno == EWOULDBLOCK) return; |
|
6014
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6015
|
0 |
0 |
if (cancel_pending(self, "read error")) return; |
|
6020
|
0 |
0 |
if (n == 0) { |
|
6023
|
0 |
0 |
int had_inflight = (self->send_count > 0 || !self->connected); |
|
|
0 |
0 |
int had_inflight = (self->send_count > 0 || !self->connected); |
|
6026
|
0 |
0 |
if (had_inflight) { |
|
6030
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6033
|
0 |
0 |
if (!self->auto_reconnect || !has_queued) { |
|
|
0 |
0 |
if (!self->auto_reconnect || !has_queued) { |
|
6034
|
0 |
0 |
if (cancel_pending(self, "connection closed")) return; |
|
6037
|
0 |
0 |
while (!ngx_queue_empty(&self->cb_queue)) { |
|
6039
|
0 |
0 |
if (cb == NULL) break; |
|
6044
|
0 |
0 |
PUSHMARK(SP); |
|
6049
|
0 |
0 |
FREETMPS; LEAVE; |
|
6052
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6060
|
0 |
0 |
if (self->auto_reconnect && self->host && self->magic == EV_CH_MAGIC) { |
|
|
0 |
0 |
if (self->auto_reconnect && self->host && self->magic == EV_CH_MAGIC) { |
|
|
0 |
0 |
if (self->auto_reconnect && self->host && self->magic == EV_CH_MAGIC) { |
|
6068
|
0 |
0 |
if (self->protocol == PROTO_HTTP) { |
|
6079
|
0 |
0 |
if (self == NULL || self->magic != EV_CH_MAGIC) return; |
|
|
0 |
0 |
if (self == NULL || self->magic != EV_CH_MAGIC) return; |
|
6081
|
0 |
0 |
if (self->connecting) { |
|
6086
|
0 |
0 |
if (self->timing) { |
|
6092
|
0 |
0 |
if (getsockopt(self->fd, SOL_SOCKET, SO_ERROR, &err, &errlen) < 0) |
|
6094
|
0 |
0 |
if (err != 0) { |
|
6100
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6101
|
0 |
0 |
if (cancel_pending(self, errbuf)) return; |
|
6111
|
0 |
0 |
if (self->ssl && !self->connected && self->native_state != NATIVE_WAIT_HELLO |
|
|
0 |
0 |
if (self->ssl && !self->connected && self->native_state != NATIVE_WAIT_HELLO |
|
|
0 |
0 |
if (self->ssl && !self->connected && self->native_state != NATIVE_WAIT_HELLO |
|
6112
|
0 |
0 |
&& self->native_state != NATIVE_WAIT_RESULT |
|
6113
|
0 |
0 |
&& self->native_state != NATIVE_WAIT_INSERT_META) { |
|
6116
|
0 |
0 |
if (ret == 1) { |
|
6120
|
0 |
0 |
if (self->protocol == PROTO_NATIVE) { |
|
6136
|
0 |
0 |
if (NULL != self->on_connect) { |
|
6142
|
0 |
0 |
PUSHMARK(SP); |
|
6145
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
6146
|
0 |
0 |
warn("EV::ClickHouse: exception in connect handler: %s", SvPV_nolen(ERRSV)); |
|
6148
|
0 |
0 |
FREETMPS; |
|
6152
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6154
|
0 |
0 |
if (!ngx_queue_empty(&self->send_queue)) |
|
6161
|
0 |
0 |
if (err == SSL_ERROR_WANT_READ) { |
|
6163
|
0 |
0 |
} else if (err == SSL_ERROR_WANT_WRITE) { |
|
6169
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6170
|
0 |
0 |
if (cancel_pending(self, "SSL handshake failed")) return; |
|
6178
|
0 |
0 |
if (revents & EV_WRITE) { |
|
6179
|
0 |
0 |
if (try_write(self)) return; |
|
6180
|
0 |
0 |
if (self->fd < 0) return; |
|
6183
|
0 |
0 |
if (revents & EV_READ) { |
|
6193
|
0 |
0 |
if (self == NULL || self->magic != EV_CH_MAGIC) return; |
|
|
0 |
0 |
if (self == NULL || self->magic != EV_CH_MAGIC) return; |
|
6197
|
0 |
0 |
if (self->connecting) { |
|
6202
|
0 |
0 |
if (check_destroyed(self)) return; |
|
6203
|
0 |
0 |
if (cancel_pending(self, "connect timeout")) return; |
|
6207
|
0 |
0 |
if (self->native_rows) { |
|
6211
|
0 |
0 |
if (self->native_col_names) { |
|
6215
|
0 |
0 |
if (self->native_col_types) { |
|
6220
|
0 |
0 |
if (self->insert_data) { |
|
6225
|
0 |
0 |
if (self->insert_av) { |
|
6229
|
0 |
0 |
if (self->insert_err) { |
|
6234
|
0 |
0 |
if (self->send_count > 0) self->send_count--; |
|
6236
|
0 |
0 |
if (deliver_error(self, "query timeout")) return; |
|
6239
|
0 |
0 |
if (cancel_pending(self, "query timeout")) return; |
|
6241
|
0 |
0 |
if (self->auto_reconnect && self->host) |
|
|
0 |
0 |
if (self->auto_reconnect && self->host) |
|
6253
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) return; |
|
6254
|
0 |
0 |
if (!self->connected || self->send_count > 0) return; |
|
|
0 |
0 |
if (!self->connected || self->send_count > 0) return; |
|
6257
|
0 |
0 |
if (self->protocol == PROTO_NATIVE) { |
|
6265
|
0 |
0 |
if (!self->writing) start_writing(self); |
|
6272
|
0 |
0 |
if (self->keepalive > 0 && !self->ka_timing && self->connected) { |
|
|
0 |
0 |
if (self->keepalive > 0 && !self->ka_timing && self->connected) { |
|
|
0 |
0 |
if (self->keepalive > 0 && !self->ka_timing && self->connected) { |
|
6280
|
0 |
0 |
if (self->ka_timing) { |
|
6293
|
0 |
0 |
if (self->magic != EV_CH_MAGIC || self->connected || self->connecting) return; |
|
|
0 |
0 |
if (self->magic != EV_CH_MAGIC || self->connected || self->connecting) return; |
|
|
0 |
0 |
if (self->magic != EV_CH_MAGIC || self->connected || self->connecting) return; |
|
6298
|
0 |
0 |
if (!self->auto_reconnect || !self->host || self->magic != EV_CH_MAGIC) return; |
|
|
0 |
0 |
if (!self->auto_reconnect || !self->host || self->magic != EV_CH_MAGIC) return; |
|
|
0 |
0 |
if (!self->auto_reconnect || !self->host || self->magic != EV_CH_MAGIC) return; |
|
6299
|
0 |
0 |
if (self->reconnect_delay <= 0) { |
|
6306
|
0 |
0 |
for (i = 0; i < self->reconnect_attempts && i < 20; i++) |
|
|
0 |
0 |
for (i = 0; i < self->reconnect_attempts && i < 20; i++) |
|
6308
|
0 |
0 |
if (self->reconnect_max_delay > 0 && delay > self->reconnect_max_delay) |
|
|
0 |
0 |
if (self->reconnect_max_delay > 0 && delay > self->reconnect_max_delay) |
|
6311
|
0 |
0 |
if (self->reconnect_timing) { |
|
6322
|
0 |
0 |
if (self->lc_dicts) { |
|
6324
|
0 |
0 |
for (c = 0; c < self->lc_num_cols; c++) { |
|
6325
|
0 |
0 |
if (self->lc_dicts[c]) { |
|
6327
|
0 |
0 |
for (j = 0; j < self->lc_dict_sizes[c]; j++) |
|
6348
|
0 |
0 |
if (!self->connected) return 0; |
|
6351
|
0 |
0 |
if (self->send_count > 0) { |
|
6357
|
0 |
0 |
if (ngx_queue_empty(&self->send_queue) && self->pending_count == 0 |
|
|
0 |
0 |
if (ngx_queue_empty(&self->send_queue) && self->pending_count == 0 |
|
6358
|
0 |
0 |
&& self->on_drain) { |
|
6365
|
0 |
0 |
PUSHMARK(SP); |
|
6370
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
6371
|
0 |
0 |
warn("EV::ClickHouse: drain callback died: %s", |
|
6373
|
0 |
0 |
FREETMPS; |
|
6377
|
0 |
0 |
if (check_destroyed(self)) return 1; |
|
6381
|
0 |
0 |
if (ngx_queue_empty(&self->send_queue) && self->pending_count == 0 |
|
|
0 |
0 |
if (ngx_queue_empty(&self->send_queue) && self->pending_count == 0 |
|
6382
|
0 |
0 |
&& self->keepalive > 0 && !self->ka_timing) { |
|
|
0 |
0 |
&& self->keepalive > 0 && !self->ka_timing) { |
|
6387
|
0 |
0 |
if (!ngx_queue_empty(&self->send_queue)) { |
|
6405
|
0 |
0 |
if (send->on_data) { SvREFCNT_dec(send->on_data); send->on_data = NULL; } |
|
6407
|
0 |
0 |
if (self->last_query_id) { Safefree(self->last_query_id); self->last_query_id = NULL; } |
|
6408
|
0 |
0 |
if (send->query_id) { self->last_query_id = send->query_id; send->query_id = NULL; } |
|
6411
|
0 |
0 |
if (send->insert_data) { |
|
6416
|
0 |
0 |
if (send->insert_av) { |
|
6429
|
0 |
0 |
double timeout = qt > 0 ? qt : self->query_timeout; |
|
6430
|
0 |
0 |
if (timeout > 0 && !self->timing) { |
|
|
0 |
0 |
if (timeout > 0 && !self->timing) { |
|
6438
|
0 |
0 |
if (self->protocol == PROTO_NATIVE) { |
|
6439
|
0 |
0 |
if (self->insert_data || self->insert_av) |
|
|
0 |
0 |
if (self->insert_data || self->insert_av) |
|
6470
|
0 |
15 |
I_EV_API("EV::ClickHouse"); |
|
|
15 |
0 |
I_EV_API("EV::ClickHouse"); |
|
|
0 |
15 |
I_EV_API("EV::ClickHouse"); |
|
6502
|
0 |
0 |
if (self->magic != EV_CH_MAGIC) return; |
|
6506
|
0 |
0 |
if (self->timing) { |
|
6510
|
0 |
0 |
if (self->ka_timing) { |
|
6514
|
0 |
0 |
if (self->reconnect_timing) { |
|
6519
|
0 |
0 |
if (PL_dirty) { |
|
6521
|
0 |
0 |
while (!ngx_queue_empty(&self->send_queue)) { |
|
6526
|
0 |
0 |
if (send->insert_data) Safefree(send->insert_data); |
|
6527
|
0 |
0 |
if (send->insert_av) SvREFCNT_dec(send->insert_av); |
|
6528
|
0 |
0 |
if (send->on_data) SvREFCNT_dec(send->on_data); |
|
6532
|
0 |
0 |
while (!ngx_queue_empty(&self->cb_queue)) { |
|
6536
|
0 |
0 |
if (cbt->on_data) SvREFCNT_dec(cbt->on_data); |
|
6541
|
0 |
0 |
#ifdef HAVE_OPENSSL |
|
6542
|
0 |
0 |
if (self->ssl) { SSL_free(self->ssl); self->ssl = NULL; } |
|
6543
|
0 |
0 |
if (self->ssl_ctx) { SSL_CTX_free(self->ssl_ctx); self->ssl_ctx = NULL; } |
|
6544
|
0 |
0 |
#endif |
|
6545
|
0 |
0 |
if (self->fd >= 0) close(self->fd); |
|
6546
|
0 |
0 |
if (self->host) Safefree(self->host); |
|
6547
|
0 |
0 |
if (self->user) Safefree(self->user); |
|
6548
|
0 |
0 |
if (self->password) Safefree(self->password); |
|
6549
|
0 |
0 |
if (self->database) Safefree(self->database); |
|
6550
|
0 |
0 |
if (self->session_id) Safefree(self->session_id); |
|
6551
|
0 |
0 |
if (self->tls_ca_file) Safefree(self->tls_ca_file); |
|
6552
|
0 |
0 |
if (self->server_name) Safefree(self->server_name); |
|
6553
|
0 |
0 |
if (self->server_display_name) Safefree(self->server_display_name); |
|
6554
|
0 |
0 |
if (self->server_timezone) Safefree(self->server_timezone); |
|
6555
|
0 |
0 |
if (self->native_rows) { SvREFCNT_dec((SV*)self->native_rows); self->native_rows = NULL; } |
|
6556
|
0 |
0 |
if (self->native_col_names) { SvREFCNT_dec((SV*)self->native_col_names); self->native_col_names = NULL; } |
|
6557
|
0 |
0 |
if (self->native_col_types) { SvREFCNT_dec((SV*)self->native_col_types); self->native_col_types = NULL; } |
|
6558
|
0 |
0 |
if (self->native_totals) { SvREFCNT_dec((SV*)self->native_totals); self->native_totals = NULL; } |
|
6559
|
0 |
0 |
if (self->native_extremes) { SvREFCNT_dec((SV*)self->native_extremes); self->native_extremes = NULL; } |
|
6560
|
0 |
0 |
if (self->default_settings) { SvREFCNT_dec((SV*)self->default_settings); self->default_settings = NULL; } |
|
6561
|
0 |
0 |
if (self->on_disconnect) { SvREFCNT_dec(self->on_disconnect); self->on_disconnect = NULL; } |
|
6562
|
0 |
0 |
if (self->on_drain) { SvREFCNT_dec(self->on_drain); self->on_drain = NULL; } |
|
6563
|
0 |
0 |
if (self->on_trace) { SvREFCNT_dec(self->on_trace); self->on_trace = NULL; } |
|
6564
|
0 |
0 |
if (self->last_query_id) Safefree(self->last_query_id); |
|
6565
|
0 |
0 |
if (self->ka_timing) { ev_timer_stop(self->loop, &self->ka_timer); self->ka_timing = 0; } |
|
6566
|
0 |
0 |
if (self->insert_data) Safefree(self->insert_data); |
|
6567
|
0 |
0 |
if (self->insert_av) SvREFCNT_dec(self->insert_av); |
|
6568
|
0 |
0 |
if (self->insert_err) Safefree(self->insert_err); |
|
6573
|
0 |
0 |
} |
|
6576
|
0 |
0 |
return; /* inner DESTROY already freed self */ |
|
6581
|
0 |
0 |
SSL_free(self->ssl); |
|
6586
|
0 |
0 |
self->ssl_ctx = NULL; |
|
6594
|
0 |
0 |
|
|
6598
|
0 |
0 |
if (NULL != self->on_connect) { |
|
6602
|
0 |
0 |
if (NULL != self->on_error) { |
|
6606
|
0 |
0 |
if (NULL != self->on_progress) { |
|
6610
|
0 |
0 |
if (NULL != self->on_disconnect) { |
|
6614
|
0 |
0 |
if (NULL != self->on_drain) { |
|
6618
|
0 |
0 |
if (NULL != self->on_trace) { |
|
6619
|
0 |
0 |
SvREFCNT_dec(self->on_trace); |
|
6620
|
0 |
0 |
self->on_trace = NULL; |
|
6621
|
0 |
0 |
} |
|
6622
|
0 |
0 |
if (self->last_query_id) { Safefree(self->last_query_id); self->last_query_id = NULL; } |
|
6623
|
0 |
0 |
if (self->host) { Safefree(self->host); self->host = NULL; } |
|
6624
|
0 |
0 |
if (self->user) { Safefree(self->user); self->user = NULL; } |
|
6625
|
0 |
0 |
if (self->password) { Safefree(self->password); self->password = NULL; } |
|
6626
|
0 |
0 |
if (self->database) { Safefree(self->database); self->database = NULL; } |
|
6627
|
0 |
0 |
if (self->session_id) { Safefree(self->session_id); self->session_id = NULL; } |
|
6628
|
0 |
0 |
if (self->tls_ca_file) { Safefree(self->tls_ca_file); self->tls_ca_file = NULL; } |
|
6629
|
0 |
0 |
if (self->server_name) { Safefree(self->server_name); self->server_name = NULL; } |
|
6630
|
0 |
0 |
if (self->server_display_name) { Safefree(self->server_display_name); self->server_display_name = NULL; } |
|
6631
|
0 |
0 |
if (self->server_timezone) { Safefree(self->server_timezone); self->server_timezone = NULL; } |
|
6632
|
0 |
0 |
if (self->native_rows) { SvREFCNT_dec((SV*)self->native_rows); self->native_rows = NULL; } |
|
6634
|
0 |
0 |
if (self->native_col_types) { SvREFCNT_dec((SV*)self->native_col_types); self->native_col_types = NULL; } |
|
6635
|
0 |
0 |
if (self->native_totals) { SvREFCNT_dec((SV*)self->native_totals); self->native_totals = NULL; } |
|
6636
|
0 |
0 |
if (self->native_extremes) { SvREFCNT_dec((SV*)self->native_extremes); self->native_extremes = NULL; } |
|
6637
|
0 |
0 |
lc_free_dicts(self); |
|
6638
|
0 |
0 |
if (self->default_settings) { SvREFCNT_dec((SV*)self->default_settings); self->default_settings = NULL; } |
|
6639
|
0 |
0 |
if (self->insert_data) { Safefree(self->insert_data); self->insert_data = NULL; } |
|
6642
|
0 |
0 |
if (self->recv_buf) { Safefree(self->recv_buf); self->recv_buf = NULL; } |
|
6656
|
0 |
0 |
if (self->tls_ca_file) Safefree(self->tls_ca_file); |
|
6664
|
0 |
0 |
if (self->connected || self->connecting) { |
|
|
0 |
0 |
if (self->connected || self->connecting) { |
|
6667
|
0 |
0 |
if (has_http_unsafe_chars(host) || has_http_unsafe_chars(user) || |
|
6668
|
0 |
0 |
has_http_unsafe_chars(password) || has_http_unsafe_chars(database)) { |
|
6672
|
0 |
0 |
if (self->host) Safefree(self->host); |
|
6673
|
0 |
0 |
if (self->user) Safefree(self->user); |
|
6674
|
0 |
0 |
if (self->password) Safefree(self->password); |
|
6675
|
0 |
0 |
if (self->database) Safefree(self->database); |
|
6690
|
0 |
0 |
if (NULL == self->host) { |
|
6694
|
0 |
0 |
if (cancel_pending(self, "connection reset")) return; |
|
6703
|
0 |
0 |
if (cancel_pending(self, "connection finished")) return; |
|
6720
|
0 |
0 |
if (items == 3) { |
|
6722
|
0 |
0 |
} else if (items == 4) { |
|
6723
|
0 |
0 |
if (!(SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV)) |
|
|
0 |
0 |
if (!(SvROK(ST(2)) && SvTYPE(SvRV(ST(2))) == SVt_PVHV)) |
|
6731
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
6734
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
6738
|
0 |
0 |
if (self->protocol == PROTO_NATIVE && (self->insert_data || self->insert_av)) { |
|
|
0 |
0 |
if (self->protocol == PROTO_NATIVE && (self->insert_data || self->insert_av)) { |
|
|
0 |
0 |
if (self->protocol == PROTO_NATIVE && (self->insert_data || self->insert_av)) { |
|
6746
|
0 |
0 |
if (settings) { |
|
6750
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVHV) { |
|
6757
|
0 |
0 |
while ((pe = hv_iternext(phv))) { |
|
6771
|
0 |
0 |
if (svp) |
|
6774
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) |
|
|
0 |
0 |
if (svp && SvOK(*svp) && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) |
|
6777
|
0 |
0 |
if (svp && SvOK(*svp)) |
|
|
0 |
0 |
if (svp && SvOK(*svp)) |
|
6783
|
0 |
0 |
if (raw && self->protocol == PROTO_NATIVE) { |
|
|
0 |
0 |
if (raw && self->protocol == PROTO_NATIVE) { |
|
6784
|
0 |
0 |
if (settings_copy) SvREFCNT_dec((SV*)settings_copy); |
|
6788
|
0 |
0 |
if (on_data_sv && self->protocol == PROTO_HTTP) { |
|
|
0 |
0 |
if (on_data_sv && self->protocol == PROTO_HTTP) { |
|
6789
|
0 |
0 |
if (settings_copy) SvREFCNT_dec((SV*)settings_copy); |
|
6793
|
0 |
0 |
if (self->protocol == PROTO_HTTP) { |
|
6806
|
0 |
0 |
if (on_data_sv) s->on_data = SvREFCNT_inc(on_data_sv); |
|
6808
|
0 |
0 |
if (settings) { |
|
6810
|
0 |
0 |
if (qid && SvOK(*qid)) { |
|
|
0 |
0 |
if (qid && SvOK(*qid)) { |
|
6819
|
0 |
0 |
if (settings_copy) SvREFCNT_dec((SV*)settings_copy); |
|
6823
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
6841
|
0 |
0 |
if (items == 4) { |
|
6843
|
0 |
0 |
} else if (items == 5) { |
|
6844
|
0 |
0 |
if (!(SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV)) |
|
|
0 |
0 |
if (!(SvROK(ST(3)) && SvTYPE(SvRV(ST(3))) == SVt_PVHV)) |
|
6852
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
6855
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
6862
|
0 |
0 |
if (SvROK(data_sv) && SvTYPE(SvRV(data_sv)) == SVt_PVAV) { |
|
|
0 |
0 |
if (SvROK(data_sv) && SvTYPE(SvRV(data_sv)) == SVt_PVAV) { |
|
6867
|
0 |
0 |
if (self->protocol == PROTO_HTTP) { |
|
6872
|
0 |
0 |
if (data_is_av) { |
|
6883
|
0 |
0 |
if (tsv_buf) Safefree(tsv_buf); |
|
6892
|
0 |
0 |
if (self->insert_data || self->insert_av) { |
|
|
0 |
0 |
if (self->insert_data || self->insert_av) { |
|
6909
|
0 |
0 |
if (settings) { |
|
6911
|
0 |
0 |
if (qid && SvOK(*qid)) { |
|
|
0 |
0 |
if (qid && SvOK(*qid)) { |
|
6923
|
0 |
0 |
if (self->protocol == PROTO_NATIVE) { |
|
6924
|
0 |
0 |
if (data_is_av) { |
|
6929
|
0 |
0 |
Newx(s->insert_data, data_len > 0 ? data_len : 1, char); |
|
6930
|
0 |
0 |
if (data_len > 0) |
|
6940
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
6952
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
|
0 |
0 |
if (!self->connected && !self->connecting) { |
|
6955
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) { |
|
6959
|
0 |
0 |
if (self->protocol == PROTO_HTTP) { |
|
6972
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
|
0 |
0 |
if (self->connected && self->callback_depth == 0) |
|
7007
|
0 |
0 |
RETVAL = self->connected ? 1 : 0; |
|
7016
|
0 |
0 |
RETVAL = self->pending_count; |
|
7025
|
0 |
0 |
if (self->server_name) { |
|
7033
|
0 |
0 |
if (n >= (int)sizeof(buf)) n = (int)sizeof(buf) - 1; |
|
7046
|
0 |
0 |
if (self->server_name) { |
|
7052
|
0 |
0 |
if (n >= (int)sizeof(buf)) n = (int)sizeof(buf) - 1; |
|
7065
|
0 |
0 |
if (self->send_count > 0) { |
|
7068
|
0 |
0 |
if (self->insert_data) { |
|
7073
|
0 |
0 |
if (self->insert_av) { |
|
7077
|
0 |
0 |
if (self->insert_err) { |
|
7081
|
0 |
0 |
if (cancel_pending(self, "skipped")) return; |
|
7102
|
0 |
0 |
if (self->session_id) Safefree(self->session_id); |
|
7118
|
0 |
0 |
self->tls_enabled = val; |
|
7128
|
0 |
0 |
if (!(SvROK(href) && SvTYPE(SvRV(href)) == SVt_PVHV)) |
|
|
0 |
0 |
if (!(SvROK(href) && SvTYPE(SvRV(href)) == SVt_PVHV)) |
|
7130
|
0 |
0 |
if (self->default_settings) |
|
7149
|
0 |
0 |
if (self->server_timezone) |
|
7189
|
0 |
0 |
if (self->native_col_names) |
|
7201
|
0 |
0 |
if (self->last_query_id) |
|
7222
|
0 |
0 |
if (self->native_col_types) |
|
7234
|
0 |
0 |
if (self->native_totals) |
|
7246
|
0 |
0 |
if (self->native_extremes) |
|
7315
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) |
|
|
0 |
0 |
if (!(SvROK(cb) && SvTYPE(SvRV(cb)) == SVt_PVCV)) |
|
7317
|
0 |
0 |
if (self->on_drain) SvREFCNT_dec(self->on_drain); |
|
7318
|
0 |
0 |
if (self->pending_count == 0 && ngx_queue_empty(&self->send_queue)) { |
|
|
0 |
0 |
if (self->pending_count == 0 && ngx_queue_empty(&self->send_queue)) { |
|
7325
|
0 |
0 |
PUSHMARK(SP); |
|
7330
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) |
|
7331
|
0 |
0 |
warn("EV::ClickHouse: drain callback died: %s", |
|
7333
|
0 |
0 |
FREETMPS; |
|
7346
|
0 |
0 |
if (self->protocol == PROTO_NATIVE && self->send_count > 0) { |
|
|
0 |
0 |
if (self->protocol == PROTO_NATIVE && self->send_count > 0) { |
|
7355
|
0 |
0 |
if (!self->writing) start_writing(self); |
|
7357
|
0 |
0 |
} else if (self->protocol == PROTO_HTTP && self->send_count > 0) { |
|
|
0 |
0 |
} else if (self->protocol == PROTO_HTTP && self->send_count > 0) { |
|
7359
|
0 |
0 |
if (self->native_rows) { |
|
7363
|
0 |
0 |
if (cancel_pending(self, "query cancelled")) return; |
|
7365
|
0 |
0 |
if (self->auto_reconnect && self->host) |
|
|
0 |
0 |
if (self->auto_reconnect && self->host) |