Skip to content

Commit

Permalink
fix(setcheckproject): bug fix with temp_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
mguzman14 committed Jan 17, 2025
1 parent d8f60ac commit 3e3a7e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions utils/fct/gw_fct_create_querytables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ BEGIN
END IF;
END IF;

-- create log tables
DROP TABLE IF EXISTS t_audit_check_data; EXECUTE 'CREATE TEMP TABLE t_audit_check_data AS SELECT * FROM audit_check_data';
DROP TABLE IF EXISTS t_audit_check_project; EXECUTE 'CREATE TEMP TABLE t_audit_check_project AS SELECT * FROM audit_check_project';


-- create anl tables
DROP TABLE IF EXISTS t_anl_node; EXECUTE 'CREATE TEMP TABLE t_anl_node AS SELECT * FROM anl_node WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_arc; EXECUTE 'CREATE TEMP TABLE t_anl_arc AS SELECT * FROM anl_arc WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_connec; EXECUTE 'CREATE TEMP TABLE t_anl_connec AS SELECT * FROM anl_connec WHERE cur_user = current_user';
DROP TABLE IF EXISTS t_anl_polygon; EXECUTE 'CREATE TEMP TABLE t_anl_polygon AS SELECT * FROM anl_polygon WHERE cur_user = current_user';


-- Return
RETURN '{"status":"ok"}';

Expand Down
4 changes: 2 additions & 2 deletions utils/fct/gw_fct_setcheckproject.sql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ BEGIN
IF v_qgis_layers_setpropierties IS NULL THEN v_qgis_layers_setpropierties = TRUE; END IF;

-- create temp tables
PERFORM gw_fct_create_checktables($${"client":{}, "form":{},"feature":{}, "data":{"parameters":{"selectionMode":"ignore"}}}$$);
PERFORM gw_fct_create_querytables($${"client":{}, "form":{},"feature":{}, "data":{"parameters":{"selectionMode":"ignore"}}}$$);

--check plugin and db version and other system parameters
IF v_qgis_version = v_version THEN
Expand All @@ -128,7 +128,7 @@ BEGIN
-- check layers from project and insert on log table
v_querytext=NULL;
FOR v_field in SELECT * FROM json_array_elements(v_insert_fields) LOOP
select into v_querytext concat(v_querytext, 'INSERT INTO '||v_schemaname||'.t_audit_check_project (table_schema, table_id, table_dbname, table_host, fid, table_user) ') ;
select into v_querytext concat(v_querytext, 'INSERT INTO t_audit_check_project (table_schema, table_id, table_dbname, table_host, fid, table_user) ') ;
select into v_querytext concat(v_querytext, 'VALUES('||quote_literal((v_field->>'table_schema'))||', '||quote_literal((v_field->>'table_id'))||', '||quote_literal((v_field->>'table_dbname'))||',
'||quote_literal((v_field->>'table_host'))||'') ;
select into v_querytext concat(v_querytext, ', '||quote_literal((v_field->>'fid'))||', '||quote_literal((v_field->>'table_user'))||');') ;
Expand Down

0 comments on commit 3e3a7e0

Please sign in to comment.