修复SQL语句错误

This commit is contained in:
wlx 2012-04-01 07:00:52 +00:00
parent 27eddb73bd
commit 7dccdbf83e
1 changed files with 6 additions and 9 deletions

View File

@ -80,7 +80,7 @@ class ISO19115
public $mdContact; public $mdContact;
public $uuid; public $uuid;
public $doi; public $doi='';
/** /**
* 数据集标题 * 数据集标题
* 字符串 * 字符串
@ -185,11 +185,10 @@ class ISO19115
} }
//save metadata into database //save metadata into database
$sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created,
timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$sth=$db->prepare($sql);
try { try {
$sth->execute(array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat, $sql="insert into metadata (uuid,title,title_en,description,citation,suppinfo,fileformat,projection,datatype,filesize,ts_created,
timebegin,timeend,west,south,north,east,doi) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$db->query($sql,array($this->uuid,$this->resTitle,$this->resAltTitle,$this->idAbs,$this->citation,$this->suppinfo,$this->fileformat,
$this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'], $this->projection,$this->datatype,$this->filesize,$this->mdDateSt,$this->timebegin,$this->timeend,$this->geoBox['w'],
$this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi)); $this->geoBox['s'],$this->geoBox['n'],$this->geoBox['e'],$this->doi));
$id=$db->lastInsertId('metadata','id'); $id=$db->lastInsertId('metadata','id');
@ -232,15 +231,14 @@ class ISO19115
$sth=$db->prepare($sql); $sth=$db->prepare($sql);
$sth->execute(array($ds['seriesName'])); $sth->execute(array($ds['seriesName']));
$trow=$sth->fetch(); $trow=$sth->fetch();
$trow=$seriestable->fetchRow($where);
if ($trow) if ($trow)
$sid=$trow['id']; $sid=$trow->id;
else { else {
$sql="insert into series (name) values(?)"; $sql="insert into series (name) values(?)";
$db->query($sql,array($ds['seriesName'])); $db->query($sql,array($ds['seriesName']));
$sid=$db->lastInsertId('series','id'); $sid=$db->lastInsertId('series','id');
} }
$sql="insert into dataserires (id,sid) values(?,?)"; $sql="insert into dataseries (id,sid) values(?,?)";
$db->query($sql,array($id,$sid)); $db->query($sql,array($id,$sid));
} }
//处理XML入库 //处理XML入库
@ -313,7 +311,6 @@ class ISO19115
//数据重复插入,此处忽略所有错误 //数据重复插入,此处忽略所有错误
print $this->uuid.' has error: '.$e->getMessage().'<br />'; print $this->uuid.' has error: '.$e->getMessage().'<br />';
} }
} }
function parse() function parse()