| | |
| | | -- drop function fn_auto_attach(integer); |
| | | create or replace function fn_auto_attach(sid integer) returns void as $$ |
| | | declare |
| | | |
| | | rec record; |
| | | tab varchar; |
| | | pid varchar; |
| | | field varchar := 'materiname'; |
| | | begin |
| | | select * from lf.sys_fme_log a where a.id = sid limit 1; |
| | | select pg_ns || '.' || tcdm, parentid into tab, pid from lf.sys_fme_log a where a.id = sid limit 1; |
| | | |
| | | --return 0; |
| | | if position('bs.' in tab) > 0 then field := 'photono'; end if; |
| | | |
| | | execute format('select count(*) from %s where parentid = ''%s'' and %s is not null', tab, pid, field) into sid; |
| | | raise notice 'tab = %, pid = %, field = %, rows = %', tab, pid, field, sid; |
| | | |
| | | if sid = 0 then return; end if; |
| | | |
| | | for rec in execute format('select eventid "tid",%s "pid" from %s where parentid=''%s'' and %s is not null', field, tab, pid, field) loop |
| | | raise notice 'eventid = %, photono = %', rec.tid, rec.pid; |
| | | end loop; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | |
| | | |
| | | select fn_auto_attach(143) |
| | | |
| | | select fn_auto_attach(142); select fn_auto_attach(143); |
| | | |
| | | select position('s_pac_hydrogeology' in 'b_pac_hydrogeology,bd.b_pac_frozensoil,bd.b_pac_geologic_hazard') |
| | | select parentid, pg_ns, tcdm, count from lf.sys_fme_log where id = 143; |
| | | select parentid, pg_ns || '.' || tcdm from lf.sys_fme_log where id = 143; |
| | | select * from lf.sys_meta where eventid = '1caa28e2-b911-40e1-bfc5-4959a927cdd1'; |
| | | select * from bs.m_marker where parentid = '1caa28e2-b911-40e1-bfc5-4959a927cdd1'; |
| | | |
| | | select * from lf.sys_fme_log |
| | | select * from lf.sys_meta a inner join lf.sys_fme_log b on a.eventid= b.parentid |
| | | select * from lf.sys_attach where tab='bs.m_marker'; |
| | | |
| | | |
| | | select * from lf.sys_attach; |
| | | select * from lf.sys_meta where name in ('警示牌10002.jpg','警示牌10004.jpg') order by id desc |
| | | delete from lf.sys_meta where name in ('警示牌10002.jpg','警示牌10004.jpg') |
| | | insert into lf.sys_attach (name, guid, path, create_user, tab, tab_guid, sizes); |
| | | |
| | | |
| | | -- insert into lf.sys_meta (name, guid, path, sizes, create_user, eventid) select name, guid, path, sizes, create_user, tab_guid from lf.sys_attach where tab='bs.m_marker'; |
| | | ----------------------------------------------------------------------------------------------------- 19.路径分析 |
| | | -- 删除已存在的函数 |
| | | -- drop function pgr_fromAtoB(varchar, double precision, double precision, double precision, double precision); |