Mercurial > hg > monetdb-perl
comparison MonetDB-CLI-MapiPP/MonetDB/CLI/Mapi.pm @ 50:96edc4137944
When processing query results, check all lines to see if a line contains an error message (i.e. starts with a '!').
This solves the problem that when an UPDATE is aborted due to transaction conflict, existing code only processes the first line of result, which contains <N> affected rows, but fails to process the second line, which contains the transaction aborted error.
Added two conditions to guard against "Use of uninitialized value" errors, one due to index-out-of-band, the other due to already closed connection.
Replaces '\t' with '\ \ '
author | Ying Zhang <y.zhang@cwi.nl> |
---|---|
date | Wed, 14 Jul 2021 22:07:16 +0200 (2021-07-14) |
parents | 44da5de4a725 |
children | 91ec04bb88c6 |
comparison
equal
deleted
inserted
replaced
49:44da5de4a725 | 50:96edc4137944 |
---|---|
231 my @chars = split(//, $row,3); | 231 my @chars = split(//, $row,3); |
232 | 232 |
233 if ($chars[0] eq '!') { | 233 if ($chars[0] eq '!') { |
234 $self->error($row); | 234 $self->error($row); |
235 my $i = 1; | 235 my $i = 1; |
236 while ($self->{lines}[$i] =~ '!') { | 236 while (defined $self->{lines}[$i] and $self->{lines}[$i] =~ '!') { |
237 $self->error($self->{lines}[$i]); | 237 $self->error($self->{lines}[$i]); |
238 $i++; | 238 $i++; |
239 } | 239 } |
240 $self->{active} = 0; | 240 $self->{active} = 0; |
241 return -1 | 241 return -1 |
286 $self->{next} = 0; # all done | 286 $self->{next} = 0; # all done |
287 $self->{offset} = 0; | 287 $self->{offset} = 0; |
288 $self->{hdrs} = []; | 288 $self->{hdrs} = []; |
289 | 289 |
290 if ($chars[0] eq '&') { | 290 if ($chars[0] eq '&') { |
291 # check for any line containing an error message in this block | |
292 my $founderr = 0; | |
293 foreach (@{$self->{lines}}) { | |
294 if (substr($_, 0, 1) eq "!"){ | |
295 $self->error($_); | |
296 $founderr++; | |
297 } | |
298 } | |
299 if ($founderr > 0) { | |
300 $self->{active} = 0; | |
301 return -1; | |
302 } | |
303 | |
291 if ($chars[1] eq '1' || $chars[1] eq 6) { | 304 if ($chars[1] eq '1' || $chars[1] eq 6) { |
292 if ($chars[1] eq '1') { | 305 if ($chars[1] eq '1') { |
293 # &1 id result-count nr-cols rows-in-this-block | 306 # &1 id result-count nr-cols rows-in-this-block |
294 my ($dummy,$id,$cnt,$nrcols,$replysize) = split(' ', $header); | 307 my ($dummy,$id,$cnt,$nrcols,$replysize) = split(' ', $header); |
295 $self->{id} = $id; | 308 $self->{id} = $id; |