fix usage of getAllEntries, adding a flag for all and default only entries that are not disabled
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2605 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
03a4bd8cd0
commit
3a7ae3f20e
@ -1256,6 +1256,9 @@ sub getNodeAttribs_nosub_returnany
|
||||
|
||||
Arguments:
|
||||
Table handle
|
||||
"all" return all lines ( even disabled)
|
||||
Default is to return only lines that have not been disabled
|
||||
|
||||
Returns:
|
||||
Hash containing all rows in table
|
||||
Globals:
|
||||
@ -1265,7 +1268,8 @@ sub getNodeAttribs_nosub_returnany
|
||||
Example:
|
||||
|
||||
my $tabh = xCAT::Table->new($table);
|
||||
my $recs=$tabh->getAllEntries();
|
||||
my $recs=$tabh->getAllEntries(); # returns entries not disabled
|
||||
my $recs=$tabh->getAllEntries("all"); # returns all entries
|
||||
|
||||
Comments:
|
||||
none
|
||||
@ -1276,8 +1280,18 @@ sub getNodeAttribs_nosub_returnany
|
||||
sub getAllEntries
|
||||
{
|
||||
my $self = shift;
|
||||
my $allentries = shift;
|
||||
my @rets;
|
||||
my $query = $self->{dbh}->prepare('SELECT * FROM ' . $self->{tabname});
|
||||
my $query;
|
||||
|
||||
if ($allentries) { # get all lines
|
||||
$query = $self->{dbh}->prepare('SELECT * FROM ' . $self->{tabname});
|
||||
} else { # get only enabled lines
|
||||
$query = $self->{dbh}->prepare('SELECT * FROM '
|
||||
. $self->{tabname}
|
||||
. " WHERE \"disable\" is NULL or \"disable\" in ('','0','no','NO','no')");
|
||||
}
|
||||
|
||||
$query->execute();
|
||||
while (my $data = $query->fetchrow_hashref())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user