Hi,all,
I have a restxq web service to do insert or update xml doc , which is
called by many clients to provide xml data to db, there will be 500000 files to
provide to basex server. I have found some problem few times :
1) often, after insert tens of thousands xml file, the db "list" will cause
error,cause db corrupt, I don't know why, How, please help me.
I don't know how to control the concurrently update db.
2) I often found there will automatically startup a basexhttp service in the
server even the manually started service still run. ???, maybe the "basexhttp
stop" command can't stop the service though it say stopped.
the restxq service code as fellow:
----------------------------------------------------------
declare
%output:method("xml")
%output:omit-xml-declaration("no")
%output:media-type("application/xml")
%updating
%rest:path("/add_ehr_doc")
%rest:POST("{$body}")
%rest:header-param("pid","{$pid}")
%rest:header-param("doc_id","{$doc_id}")
%rest:header-param("op","{$op}","APND")
function ehr:add_ehr_doc(
$body,$pid as xs:string,$doc_id as xs:string,$op as xs:string
)
{
let $dbname: ='myehr'
let
$fp:=substring($pid,1,6)||'/'||substring($pid,7,8)||'/'||substring($pid,15)||'.xml'
(: pid is a patient id code as: area_code-section_code-serialnumber :)
return
try{
if (db:exists($dbname,$fp)) then
(
insert node ($body//*:DataSet) into
(doc($dbname||"/"||$fp)//*:BasicDataset),
db:output(<msg><Ack>200:append</Ack><Url>{$fp}</Url></msg>)
)
else
(
db:add($dbname, $body,$fp),db:output(<msg><Ack>200 new
add</Ack><Url>{$fp}</Url></msg>)
)
} catch *{
db:output(<msg><Ack>201 error</Ack></msg>)
}
};
--
此致
林晓东
莫愁前路无知己,天下谁人不识君。
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk