Changeset: dd1d45ab8ed5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dd1d45ab8ed5
Modified Files:
sql/backends/monet5/copy.c
sql/backends/monet5/copy_scan.c
Branch: default
Log Message:
only scan rows if fix/splitlines found some lines
diffs (44 lines):
diff --git a/sql/backends/monet5/copy.c b/sql/backends/monet5/copy.c
--- a/sql/backends/monet5/copy.c
+++ b/sql/backends/monet5/copy.c
@@ -75,7 +75,7 @@ bufferstream_read( bufferstream *bs, int
int ocur = bs->cur_buf;
assert(bs->eof || !bs->buf[0] || cur == (ocur+1)%bs->nr_bufs);
if (bs->eof || mnstr_eof(bs->s)) {
- if (bs->pos[ocur] == bs->len[ocur])
+ if (bs->pos[ocur] >= bs->len[ocur])
bs->eof = 1;
return 0;
}
@@ -639,12 +639,14 @@ COPYsplitlines(Client cntxt, MalBlkPtr m
return_indices[i] = Tloc(b, 0);
}
- if (r->col_sep_len > 1)
- msg = scan_fieldsN(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
- else if (r->can_jump)
- msg = scan_fields1(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
- else
- msg = scan_fields(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
+ if (line_count) {
+ if (r->col_sep_len > 1)
+ msg = scan_fieldsN(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
+ else if (r->can_jump)
+ msg = scan_fields1(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
+ else
+ msg = scan_fields(&errors, &state, r->null_repr,
r->null_repr_len, ncols, line_count, return_indices);
+ }
end:
copy_destroy_error_handling(&errors);
diff --git a/sql/backends/monet5/copy_scan.c b/sql/backends/monet5/copy_scan.c
--- a/sql/backends/monet5/copy_scan.c
+++ b/sql/backends/monet5/copy_scan.c
@@ -579,6 +579,7 @@ scan_fields1(
{
int row = 0;
int col = 0;
+ assert(state->pos < state->end);
while (state->pos < state->end && row < nrows) {
unsigned char sep = 0;
int field_offset;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]