diff --git a/db/xmlconvert.in b/db/xmlconvert.in index cf956ca0cb71a9ccc152da384961fc1123d311d8..a13e1742e1646f1c2c71931c0a67a71f7eac3b5b 100644 --- a/db/xmlconvert.in +++ b/db/xmlconvert.in @@ -324,8 +324,22 @@ sub readXML($$$) { } push(@fields, $key); } - $query = "insert into $table (" . join(",", @fields) . ") ". - "values (" . join(",", @values) . ") "; + # If we are called after an nseparse, we need to + # use replace coz some of the tables such as + # virt_agents and eventlist are not truly + # virtual tables. That is coz they contain the + # vnode field which is the same as the vname + # field in the reserved table. For simulated + # nodes, the mapping may change across swapins + # and the event may have to be delivered to a + # different simhost + if ( $simparse ) { + $query = "replace into $table (" . join(",", @fields) . ") ". + "values (" . join(",", @values) . ") "; + } else { + $query = "insert into $table (" . join(",", @fields) . ") ". + "values (" . join(",", @values) . ") "; + } print "$query\n" if ($debug);