add support for DB2 in Where clause

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5684 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2010-04-06 13:34:11 +00:00
parent 2067bafb90
commit f473040ca5

View File

@ -722,12 +722,19 @@ sub tabprune_recid {
my $cb = shift;
my $recid = shift;
my $rc=0;
# check which database so can build the correct Where clause
my $DBname = xCAT::Utils->get_DBName;
my $tab = xCAT::Table->new($table, -create => 1, -autocommit => 0);
unless ($tab) {
$cb->({error => "Unable to open $table",errorcode=>4});
return 1;
}
my @ents=$tab->getAllAttribsWhere("recid<$recid", 'recid');
my @ents;
if ($DBname =~ /^DB2/) {
@ents=$tab->getAllAttribsWhere("\"recid\"<$recid", 'recid');
} else {
@ents=$tab->getAllAttribsWhere("recid<$recid", 'recid');
}
foreach my $rid (@ents) {
$tab->delEntries($rid);
}