diff MonetDB-CLI-MapiPP/MonetDB/CLI/MapiPP.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
line wrap: on
line diff
--- a/MonetDB-CLI-MapiPP/MonetDB/CLI/MapiPP.pm
+++ b/MonetDB-CLI-MapiPP/MonetDB/CLI/MapiPP.pm
@@ -27,7 +27,7 @@ sub connect
   my ($class, $host, $port, $user, $pass, $lang, $db) = @_;
 
   my $h = new MonetDB::CLI::Mapi($host, $port, $user, $pass, $lang, $db, 0)
-  	or die "Making connection failed: $@";
+    or die "Making connection failed: $@";
 
   bless { h => $h },'MonetDB::CLI::MapiPP::Cxn';
 }
@@ -56,7 +56,9 @@ sub DESTROY
 {
   my ($self) = @_;
 
-  $self->{h}->disconnect();
+  if (defined $self->{h}) {
+    $self->{h}->disconnect();
+  }
 
   return;
 }