Commit 6ab03d5f authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Fix for the problem of not setting default values when inserting

experiment table rows after a parse. It used to be that slots that
were not explicitly given values by the parser would be left as
whatever they were in the DB. Now I get the default values by doing
a "describe experiments" query, inserting those values for any slot
that is not set by the parser.
parent 91b97971
......@@ -309,6 +309,24 @@ sub readXML($$$$) {
if ( (! $simparse) && scalar(keys(%experiments_table))) {
my @setlist = ();
my $describe_result =
DBQueryFatal("describe experiments");
# Need to find the default values for slots that are not sent to
# us in the xml so that we can set them properly.
while (my $rowref = $describe_result->fetchrow_hashref()) {
my $slot = $rowref->{"Field"};
my $value = $rowref->{"Default"};
if (exists($experiment_fields{$slot}) &&
! exists($experiments_table{$slot})) {
$experiments_table{$slot} =
(defined($value) ? $value : "NULL");
foreach my $key (keys(%experiments_table)) {
my $val = $experiments_table{$key};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment