修复同步时未同步source错误

This commit is contained in:
wlx 2011-10-25 08:48:51 +00:00
parent 3cbdd0bf71
commit bcfb19fecc
1 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class Admin_DataController extends Zend_Controller_Action
//$uuid=$this->_request->getParam('uuid'); //$uuid=$this->_request->getParam('uuid');
if ($source=="geonetwork" && empty($uuid) ) { if ($source=="geonetwork" && empty($uuid) ) {
//从geonetwork向WESTDC同步 //从geonetwork向WESTDC同步
$sql="select uuid,data from geonetworkmetadata where schemaid='iso19115'"; $sql="select uuid,data,source from geonetworkmetadata where schemaid='iso19115'";
$rs=$this->db->fetchAll($sql); $rs=$this->db->fetchAll($sql);
foreach($rs as $gmd) { foreach($rs as $gmd) {
$this->import($gmd->data); $this->import($gmd->data);
@ -45,12 +45,12 @@ class Admin_DataController extends Zend_Controller_Action
} elseif ($source=="watergn" && empty($uuid) ) { } elseif ($source=="watergn" && empty($uuid) ) {
//首先删除所有的黑河试验数据 //首先删除所有的黑河试验数据
//$sql="delete from metadata where source='e3ad32dc-f573-11e0-aa7b-b768cfd88d80'"; //$sql="delete from metadata where source='e3ad32dc-f573-11e0-aa7b-b768cfd88d80'";
$sql="delete from metadata where uuid in (select uuid from heihegn)"; $sql="delete from metadata where uuid in (select uuid from watergn)";
$this->db->query($sql); $this->db->query($sql);
$sql="delete from responsible where id not in (select distinct(resid) from role)"; $sql="delete from responsible where id not in (select distinct(resid) from role)";
$this->db->query($sql); $this->db->query($sql);
//同步黑河遥感实验的元数据 //同步黑河遥感实验的元数据
$sql="select uuid,data,source from heihegn where schemaid='iso19115'"; $sql="select uuid,data,source from watergn where schemaid='iso19115'";
$rs=$this->db->fetchAll($sql); $rs=$this->db->fetchAll($sql);
foreach($rs as $gmd) { foreach($rs as $gmd) {
$this->import($gmd->data); $this->import($gmd->data);
@ -68,7 +68,7 @@ class Admin_DataController extends Zend_Controller_Action
$sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid in (select uuid from geonetworkmetadata)"; $sql="select m.uuid,m.source,x.data from metadata m left join xml x on m.id=x.id where m.uuid in (select uuid from geonetworkmetadata)";
$rs=$this->db->fetchAll($sql); $rs=$this->db->fetchAll($sql);
foreach($rs as $gmd) { foreach($rs as $gmd) {
$sql="update geonetworkmetadata set source='".$gmd->source."',data=".$this->db->quote($gmd->data)." where uuid='".$gmd->uuid."'"; $sql="update geonetworkmetadata set source='".$gmd->source."',data=".$this->db->quote($gmd->data)." where uuid='".$gmd->uuid."'";
$this->db->exec($sql); $this->db->exec($sql);
} }
$this->view->msg='成功同步WESTDC元数据到GEONETWORK'; $this->view->msg='成功同步WESTDC元数据到GEONETWORK';