Added function to delete the file from the documents, document_roles tables and wwv_flow_files view. It accepts the document id (from the documents table)
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3432 248e525c-4dfb-0310-94bc-949c084e9493
This commit is contained in:
@@ -5,6 +5,7 @@ create or replace package MIP_FILES is
|
|||||||
-- Purpose : Handle files for the webMIP system
|
-- Purpose : Handle files for the webMIP system
|
||||||
|
|
||||||
-- Public function and procedure declarations
|
-- Public function and procedure declarations
|
||||||
|
function delete_file(p_id number) return boolean;
|
||||||
function drawing_file_exists(p_drwg_code varchar2) return boolean;
|
function drawing_file_exists(p_drwg_code varchar2) return boolean;
|
||||||
function update_file_association(p_uri in varchar2,
|
function update_file_association(p_uri in varchar2,
|
||||||
p_description in varchar2,
|
p_description in varchar2,
|
||||||
@@ -28,6 +29,30 @@ PROCEDURE export_table_to_csv(p_table IN VARCHAR2,
|
|||||||
end MIP_FILES;
|
end MIP_FILES;
|
||||||
/
|
/
|
||||||
create or replace package body MIP_FILES as
|
create or replace package body MIP_FILES as
|
||||||
|
/*
|
||||||
|
FUNCTION delete_file
|
||||||
|
- takes the id of a file held in the documents table and deletes the associated document
|
||||||
|
- in the documents, document_roles and wwv_flow_files tables and view
|
||||||
|
%param p_id - the id of the file
|
||||||
|
*/
|
||||||
|
function delete_file(p_id number) return boolean is
|
||||||
|
l_uri documents.uri%type;
|
||||||
|
CURSOR c_get_uri(cp_id number) is
|
||||||
|
select uri
|
||||||
|
from documents
|
||||||
|
where id=cp_id;
|
||||||
|
begin
|
||||||
|
IF NOT c_get_uri%ISOPEN THEN
|
||||||
|
OPEN c_get_uri(p_id);
|
||||||
|
END IF;
|
||||||
|
FETCH c_get_uri
|
||||||
|
INTO l_uri;
|
||||||
|
CLOSE c_get_uri;
|
||||||
|
delete document_roles where document_roles.docu_id = p_id;
|
||||||
|
delete documents where documents.id = p_id;
|
||||||
|
delete wwv_flow_files where wwv_flow_files.name = l_uri;
|
||||||
|
return true;
|
||||||
|
end delete_file;
|
||||||
/*
|
/*
|
||||||
FUNCTION drawing_file_exists
|
FUNCTION drawing_file_exists
|
||||||
- takes the drawing code and searches for associated file in APEX Application
|
- takes the drawing code and searches for associated file in APEX Application
|
||||||
|
|||||||
Reference in New Issue
Block a user