DBA Data[Home] [Help]

PACKAGE BODY: APPS.XLA_UTIL

Source


1 PACKAGE BODY XLA_UTIL AS
2 /* $Header: xlautil.pkb 120.1 2011/02/04 13:03:59 sgullape ship $ */
3 
4 /*===========================================================================*/
5 /* PRIVATE VARIABLES
6 /*===========================================================================*/
7 debug_flag		BOOLEAN := FALSE;
8 file_debug_flag		BOOLEAN := FALSE;
9 pg_fp           	utl_file.file_type;
10 
11 pg_query_context      	VARCHAR2(100) := NULL;
12 
13 /*===========================================================================*/
14 /* PRIVATE PROCEDURES/FUNCTIONS
15 /*===========================================================================*/
16 
17 PROCEDURE file_debug( text in varchar2 ) is
18 BEGIN
19   if file_debug_flag then
20     utl_file.put_line(pg_fp, text);
21     utl_file.fflush(pg_fp);
22   end if;
23 END;
24 
25 
26 /*===========================================================================*/
27 /* PUBLIC PROCEDURES/FUNCTIONS
28 /*===========================================================================*/
29 
30 PROCEDURE enable_debug is
31 BEGIN
32   debug_flag := TRUE;
33   -- Bug 3966062
34   -- dbms_output.enable;
35 END enable_debug;
36 
37 PROCEDURE enable_debug(buffer_size	NUMBER) is
38 BEGIN
39   debug_flag := TRUE;
40   -- Bug 3966062
41   --dbms_output.enable( buffer_size );
42 END;
43 
44 PROCEDURE enable_debug(path_name in varchar2,
45                        file_name in varchar2 default 'DEFAULT') IS
46 BEGIN
47   if not file_debug_flag then	-- Ignore multiple calls to enable_debug
48     pg_fp := utl_file.fopen(path_name, file_name||'.dbg', 'w');
49     file_debug_flag := TRUE;
50   end if;
51 EXCEPTION
52   when utl_file.invalid_path then
53 	-- fnd_message.set_name('AR', 'GENERIC_MESSAGE');
54 	-- fnd_message.set_token('GENERIC_TEXT', 'Invalid path: '||path_name);
55 	app_exception.raise_exception;
56   when utl_file.invalid_mode then
57 	-- fnd_message.set_name('AR', 'GENERIC_MESSAGE');
58 	-- fnd_message.set_token('GENERIC_TEXT', 'Cannot open file '||file_name||
59 --				 ' in write mode.');
60 	app_exception.raise_exception;
61 END enable_debug;
62 
63 PROCEDURE disable_debug is
64 BEGIN
65   debug_flag := FALSE;
66 
67   if file_debug_flag then
68     file_debug_flag := FALSE;
69     utl_file.fclose(pg_fp);
70   end if;
71 END disable_debug;
72 
73 PROCEDURE debug(text	IN VARCHAR2) is
74   rest varchar2(32767);
75   buffer_overflow exception;
76   pragma exception_init(buffer_overflow, -20000);
77 BEGIN
78 
79   if file_debug_flag then
80     file_debug(text);
81   else
82     if debug_flag then
83         rest := text;
84         loop
85             if( rest is null ) then
86                 exit;
87             else
88 	        -- Bug 3966062
89                 -- dbms_output.put_line(substrb(rest, 1, 255));
90                 rest := substrb(rest, 256);
91             end if;
92 
93         end loop;
94     end if;
95   end if;
96 EXCEPTION
97   when buffer_overflow then
98       null;  -- buffer overflow, ignore
99   when others then
100       raise;
101 END debug;
102 
103 PROCEDURE set_query_context (
104 		p_context       IN  VARCHAR2) IS
105 BEGIN
106  pg_query_context := p_context;
107 END;
108 
109 FUNCTION get_query_context RETURN VARCHAR2 IS
110 BEGIN
111   RETURN ( pg_query_context );
112 END;
113 
114 -- lgandhi bug 2969915 Created a new function to check the the existence of the function in the data base.
115 -- Its a wrapper over  FND_FUNCTION.GET_FUNCTION_ID
116 -- returns: the function id, or NULL if it can't be found.
117 
118 
119 FUNCTION get_function_id(p_function_name in varchar2  ) RETURN NUMBER IS
120 BEGIN
121   RETURN (fnd_function.get_function_id (p_function_name));
122 END;
123 
124 
125 END XLA_UTIL;