From c760a04d27fd95b02d41fecf506bd1b08cf0e6a6 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 26 Oct 2010 08:11:34 +0000 Subject: [PATCH] fix for bug 3091008: special case for DB2 SQL statement git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7928 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 7 ++++++- xCAT-server/lib/xcat/monitoring/monitorctrl.pm | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index a03c33143..af0e8fdd1 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -1756,7 +1756,12 @@ sub setAttribsWhere #update the rows for my $col (keys %$elems) { - $cols = $cols . $col . " = ?,"; + my $DBname = xCAT::Utils->get_DBName; + if ($DBname =~ /^DB2/) { + $cols = $cols . "\"$col\"" . " = ?,"; + } else { + $cols = $cols . $col . " = ?,"; + } push @bind, (($$elems{$col} =~ /NULL/) ? undef: $$elems{$col}); } chop($cols); diff --git a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm index 4fdcf0023..14ed0ccd7 100644 --- a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm +++ b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm @@ -636,7 +636,16 @@ sub setNodeStatusAttributes { if (@$nodes > 0) { $updates{'status'} = $_; $updates{'statustime'} = $currtime; - my $where_clause="node in ('" . join("','", @$nodes) . "')"; + my $where_clause; + my $DBname = xCAT::Utils->get_DBName; + if ($DBname =~ /^DB2/) { + foreach my $nd (@$nodes) { + $where_clause .= "\"node\" LIKE \'$nd\' OR" + } + $where_clause =~ s/OR$//; + } else { + $where_clause="node in ('" . join("','", @$nodes) . "')"; + } $tab->setAttribsWhere($where_clause, \%updates ); } }