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
This commit is contained in:
ligc 2010-10-26 08:11:34 +00:00
parent 8dd55fccbe
commit c760a04d27
2 changed files with 16 additions and 2 deletions

View File

@ -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);

View File

@ -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 );
}
}