Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
78f183ff
Commit
78f183ff
authored
Jun 06, 2014
by
Leigh B Stoller
Browse files
Add LookupByType().
parent
a49ace41
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/Node.pm.in
View file @
78f183ff
...
...
@@ -332,6 +332,30 @@ sub BulkLookup($$$)
return
0
;
}
#
#
Lookup
all
nodes
of
a
type
#
sub
LookupByType
($$)
{
my
($
class
,
$
type
)
=
@
_
;
my
@
result
=
();
my
$
query_result
=
DBQueryWarn
(
"select node_id from nodes as n where n.type='$type'"
);
return
()
if
(
!$query_result);
while
(
my
($
node_id
)
=
$
query_result
->
fetchrow_array
())
{
my
$
node
=
Node
->
Lookup
($
node_id
);
if
(
!defined($node)) {
print
STDERR
"No such node $node_id
\n
"
;
next
;
}
push
(@
result
,
$
node
);
}
return
@
result
;
}
sub
Create
($$$$)
{
my
($
class
,
$
node_id
,
$
experiment
,
$
argref
)
=
@
_
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment