-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfileout.html
More file actions
204 lines (164 loc) · 6.93 KB
/
fileout.html
File metadata and controls
204 lines (164 loc) · 6.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- WARNING! This file is generated. -->
<!-- To alter documentation, edit files in src directory -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Configuring the File Reporter</title>
<link rel="stylesheet" href="utplsql.css" type="text/css" />
<meta name="keywords" content="utPLSQL, PL\SQL, Unit Testing, Framework, Oracle" />
<meta name="description" content="Unit Testing PL\SQL" />
<meta name="title" content="Configuring the File Reporter" />
<meta name="author" content="Steven Feuerstein, Chris Rimmer, Patrick Barel and the utPLSQL Project" />
<meta name="copyright" content="(C) 2000-2005, 2014-2016 Steven Feuerstein, Chris Rimmer, Patrick Barel and the utPLSQL Project" />
</head>
<body>
<div class="purple_bar"><a href="index.html"><img src="utplsql.jpg" alt="utPLSQL logo" /></a></div>
<p>[ <a href="index.html">Home</a>
| <a href="started.html">Getting Started</a>
| <a href="buildpack.html">Build Test Packages</a>
| <a href="examples.html">Examples</a>
| <a href="userguide.html">User Guide</a>
| <a href="release.html">Release Notes</a>
| <a href="map.html">Document Map</a> ]</p>
<p><a href="reporter.html">< Previous Section: Custom Reporter Packages</a> | <a href="release.html">Next Section: Release Notes ></a></p>
<!-- Begin utPLSQL Body -->
<!-- $Id$ -->
<h1>Configuring the File Reporter</h1>
<h2><a name="outline"></a>Outline</h2>
<p>
By default, the results of a test run are written to the screen
(via the default Output Reporter). The subprograms described in this
section were created by Rainer Medert to allow these results to be written
to file instead. They form part of the utConfig package. Don't forget that
you will first need to enable file output from the database via the
UTL_FILE_DIR parameter in order to do this.
</p>
<h2><a name="setgetfile"></a>Turning file output on</h2>
<p>
To turn on file output, you will need to switch to using the File
Reporter, or a custom reporter that uses it. See the page on <a href="reporter.html">Custom Reporter Packages</a> for details.
</p>
<h2><a name="setfiledir"></a>Setting the directory to be used</h2>
<p>
Once file output has been turned on, you can specify which directory the
files will be written to using the following procedure:
</p>
<pre>
PROCEDURE setfiledir (
dir_in IN VARCHAR2 := NULL,
username_in IN VARCHAR2 := NULL
);
</pre>
<p>
the directory given will have to have been specified for output in a
UTL_FILE_DIR database parameter, as mentioned above.
</p>
<p>To see which directory is being used for output, use the following:</p>
<pre>
FUNCTION filedir (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
</pre>
<h2><a name="filename1"></a>Formatting the output filenames</h2>
<p>The structure of the filenames used for output is as follows:</p>
<pre>
<user-prefix>_[program-name_]<date><extension>
</pre>
<p>Each of these elements can be configured using the following procedures.</p>
<p>
The user-prefix is an arbitrary string. It defaults to the username of
the currently connected user, but can be set (and returned) using the
following:
</p>
<pre>
-- Set the file prefix for a user
PROCEDURE setuserprefix (
userprefix_in IN VARCHAR2 := NULL,
username_in IN VARCHAR2 := NULL
);
-- Get the file prefix for a user
FUNCTION userprefix (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
</pre>
<p><a name="filename2"></a>
The program-name is the name of the tested program, or the test suite
being run. By default, this is element is not used in the generated filename.
To turn this on or off (and to determine the current setting), use the
following:
</p>
<pre>
-- Set the include program name flag for a user
PROCEDURE setincludeprogname (
incname_in IN BOOLEAN := FALSE,
username_in IN VARCHAR2 := NULL
);
-- Get the include program name flag for a user
FUNCTION includeprogname (username_in IN VARCHAR2 := NULL) RETURN BOOLEAN;
</pre>
<p><a name="filename3"></a>
The date element of the filename is simply SYSDATE converted to a string.
The default format is 'YYYYDDMMHH24MISS', but this can be set (and
returned) using the following:
</p>
<pre>
-- Set the date format for a user
PROCEDURE setdateformat (
dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
username_in IN VARCHAR2 := NULL
);
-- Get the date format for a user
FUNCTION dateformat (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
</pre>
<p><a name="filename4"></a>
The final element of the filename that can be configured is the extension.
This defaults to ".UTF" but can be set (and returned) using the following:
</p>
<pre>
-- Set the file extension for a user
PROCEDURE setfileextension (
fileextension_in IN VARCHAR2 := '.UTF',
username_in IN VARCHAR2 := NULL
);
-- Get the file extension for a user
FUNCTION fileextension (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
</pre>
<p>
<b>Note</b> The initial dot must be included, otherwise there will be none
in the resulting filename!
</p>
<h2><a name="allinone"></a>Setting all the parameters at once</h2>
<p>
It is possible to set all the file output parameters at once using the
following procedure:
</p>
<pre>
PROCEDURE setfileinfo (
dir_in IN VARCHAR2 := NULL,
userprefix_in IN VARCHAR2 := NULL,
incname_in IN BOOLEAN := FALSE,
dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
fileextension_in IN VARCHAR2 := '.UTF',
username_in IN VARCHAR2 := NULL
);
</pre>
<p>
To get back all of the file output parameters simultaneously, use the
following function:
</p>
<pre>
FUNCTION fileinfo (username_in IN VARCHAR2 := NULL) RETURN rec_fileinfo;
</pre>
<p>
The record type <code>rec_fileinfo</code> is defined in the utConfig
package and has one field for each of the parameters.
</p>
<!-- End utPLSQL Body -->
<p><a href="reporter.html">< Previous Section: Custom Reporter Packages</a> | <a href="release.html">Next Section: Release Notes ></a></p>
<div class="purple_bar"><a href="index.html"><img src="utplsql.jpg" alt="utPLSQL logo" /></a></div>
<p>
<a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" />
</a>
</p>
<p class="copyright">Copyright © 2000-2005, 2014-2016 <a href="mailto:steven@stevenfeuerstein.com">Steven Feuerstein</a>, <a href="mailto:c@24.org.uk">Chris Rimmer</a>, <a href="mailto:pbarel@vda.nl">Patrick Barel</a> and the utPLSQL Project. All rights reserved</p>
</body>
</html>