Hello again!

I've got the XQJ API working, but I have problems with a particular query.

So I have two documents, one containing hosts data, and one containing
virtual machines data. When I add (or remove) a virtual machine from a host,
I want to update the space available on the host. The query looks like this:
UPDATE replace $x in doc("Hosts")//Hosts/Host[Name = "test1"]/FreeSpace with
$x - 30

And this is the error I get:
Error updating host info in the database: SEDNA Message: ERROR SE2021
Invalid result of the update argument: sequence contains atomic values

For additional information, here is the code raising the error:
  private boolean updateHost(VirtualMachine vm, boolean addVM) {
    try
    {
      String operator = addVM ? "-" : "+";
      String query =
            "UPDATE replace $x in doc(\"Hosts\")//Hosts/Host[Name = \"" +
vm.Host + "\"]/FreeSpace " +
            "with $x " + operator + " " + vm.Size;
      System.out.println(query);
      XQExpression exp = xqconn.createExpression();
      exp.executeCommand(query);
      //xqconn.commit();
      return true;

    } catch (XQException e) {
        System.err.println("Error updating host info in the database: " +
e.getMessage());
        return false;
    }
  }

I'd like to point out I'm able to make other queries like UPDATE insert or
UPDATE delete. Could it be the "$x - 30" bit giving trouble? Maybe I can't
add or substract from a variable like this?
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to