Re: [bdbxml] XmlModify and transactions in PHP
Joseba Umbelina <[email protected]> Mon, 17 Apr 2006 16:30:47 +0000 (UTC)
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
Hi all. Related with this, I have a strange problem with this script for modify
a document (I have cuted the second query because was > 80 characters):
<?php
$mgr=new XmlManager(null);
$con=$mgr->openContainer("userscontainer.dbxml");
$qc=$mgr->createQueryContext();
$uc=$mgr->createUpdateContext();
$mod=$mgr->createModify();
$select=$mgr->prepare("/user[@uname='maria']/name", $qc);
$mod->addUpdateStep($select,"aaaa");
$doc=$mgr->query("doc('userscontainer.dbxml/userdb')/users");
$mod->execute($doc, $qc, $uc);
unset($doc);
unset($con);
//Print the modified database as XML document:
$con=$mgr->openContainer("userscontainer.dbxml");
$results=$mgr->query("collection('userscontainer.dbxml')
/users/user[@uname='maria']/name");
$results->reset();
$filename ="prueba.xml";
$file= fopen($filename,'w+');
while($results->hasNext())
{
$val=$results->next();
$doc=$val->asDocument();
fputs ($file, $val->asString()."\n");
}
$con->close();
header ("Location: prueba.xml");
fclose($file);
?>
The problem is that works fine the first time, modifing the 'name' content to
"aaaa". But If I try a second time replacing "aaaa" with other string, doent's
change anything at the document. I delete de "prueba.xml" file, restart the
browser, but nothing. The only way to get working again, it's to create again
the container at put the xml element, like the first time:
I do it with the dbxml shell:
dbxml> createContainer userscontainer.dbxml
Creating node storage container with nodes indexed
dbxml> openContainer userscontainer.dbxml
dbxml> putdocument userdb base.xml f
Document added, name = userdb
dbxml> exit
Do you know which can be the problem?
I tried with transactions and I have the same problem..
Thank you very much. Bye.
------------------------------------------
To remove yourself from this list, send an
email to [email protected]