Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
38c99582
Commit
38c99582
authored
Jul 21, 2006
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor bug fix.
Also add an Update method.
parent
a6351f3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
db/Experiment.pm.in
db/Experiment.pm.in
+35
-2
No files found.
db/Experiment.pm.in
View file @
38c99582
...
...
@@ -125,7 +125,7 @@ sub autoswap_timeout($) { return field($_[0], 'autoswap_timeout');}
sub
prerender_pid
($)
{
return
field
($
_
[
0
],
'prerender_pid'
);}
#
#
Lookup
a
template
given
an
experiment
index
.
#
Lookup
a
n
experiment
given
an
experiment
index
.
#
sub
LookupByIndex
($$)
{
...
...
@@ -293,6 +293,10 @@ sub Create($$$$)
my
$
noidleswap_reason
=
DBQuoteSpecial
($
argref
->{
'noidleswap_reason'
});
delete
($
argref
->{
'noidleswap_reason'
});
#
we
override
this
below
delete
($
argref
->{
'idx'
})
if
(
exists
($
argref
->{
'idx'
}));
my
$
query
=
"insert into experiments set "
.
join
(
","
,
map
(
"$_='"
.
$
argref
->{$
_
}
.
"'"
,
keys
(%{$
argref
})));
...
...
@@ -301,6 +305,7 @@ sub Create($$$$)
$
query
.=
",expt_name=$description"
;
$
query
.=
",noswap_reason=$noswap_reason"
;
$
query
.=
",noidleswap_reason=$noidleswap_reason"
;
$
query
.=
",idx=$exptidx"
;
if
(
! DBQueryWarn($query)) {
DBQueryWarn
(
"unlock tables"
);
...
...
@@ -434,6 +439,31 @@ sub Refresh($)
return
0
;
}
#
#
Perform
some
updates
...
#
sub
Update
($$)
{
my
($
self
,
$
argref
)
=
@
_
;
#
Must
be
a
real
reference
.
return
-
1
if
(
! ref($self));
my
$
pid
=
$
self
->
pid
();
my
$
eid
=
$
self
->
eid
();
my
$
query
=
"update experiments set "
.
join
(
","
,
map
(
"$_='"
.
$
argref
->{$
_
}
.
"'"
,
keys
(%{$
argref
})));
$
query
.=
" where pid='$pid' and eid='$eid'"
;
return
-
1
if
(
! DBQueryWarn($query));
return
Refresh
($
self
);
}
#
#
Stringify
for
output
.
#
...
...
@@ -465,7 +495,10 @@ sub AccessCheck($$$)
}
#
#
Create
the
directory
structure
.
#
Create
the
directory
structure
.
A
template_mode
experiment
is
the
one
#
that
is
created
for
the
template
wrapper
,
not
one
created
for
an
#
instance
of
the
experiment
.
The
path
changes
slightly
,
although
that
#
happens
down
in
the
mkexpdir
script
.
#
sub
CreateDirectory
($)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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