fix sql error

This commit is contained in:
wlx 2014-09-18 07:17:13 +00:00
parent a03634d816
commit 5fef38b8ab
2 changed files with 4 additions and 3 deletions

View File

@ -3253,7 +3253,8 @@ class Admin_DataController extends Zend_Controller_Action
//查看所有的未提交数据列表
else if((empty($ac) && empty($uuid))|| $ac=='list')
{
$sql = "SELECT (regexp_matches(gn.data,'<resTitle>(.*)</resTitle>'))[1] as title,gn.id,gn.uuid,u.username,u.realname FROM en.geonetworkmetadata gn left join users u on gn.owner=u.id
$sql = "SELECT (regexp_matches(gn.data,'<resTitle>(.*)</resTitle>'))[1] as title,gn.id,gn.uuid,u.username,u.realname,t.count as version_count FROM en.geonetworkmetadata gn left join users u on gn.owner=u.id
left join (select count(*),uuid from en.mdversion group by uuid) t on t.uuid=gn.uuid
WHERE gn.uuid not in (select uuid from en.metadata)
order by gn.id desc
";

View File

@ -2374,8 +2374,8 @@ class AuthorController extends Zend_Controller_Action
// 保存数据作者信息
// 仅保存不存在的作者信息
$sql="insert into mdauthor (uuid,userid,ts_activated,status) select ?,?,now(),1 where not exists
(select * from mdauthor where uuid=? and userid=?)";
$this->db->query($sql,array($row['uuid'],$u_id),$row['uuid'],$u_id));
(select id from mdauthor where uuid=? and userid=?)";
$this->db->query($sql,array($row['uuid'],$u_id),$row['uuid'],$u_id);
// 2. 保存变化记录 save changelog & userid for the latest version
$sql = "UPDATE en.mdversion SET changelog=?,userid=? WHERE id in (select id from en.mdversion where uuid=? order by ts_created desc limit 1)";