1 PACKAGE dbms_reputil AS
2
3 ------------
4 -- OVERVIEW
5 --
6 -- This package is referenced only by the generated code.
7
8 ---------------------------
9 -- PROCEDURES AND FUNCTIONS
10 --
11
12 FUNCTION from_remote
13 RETURN BOOLEAN;
14 -- in internal packages, we don't want to call PL/SQL to set from_remote,
15 -- hence, convert from_remote to a function.
16 -- clients are not supposed to assign values to this variable.
17
18 FUNCTION global_name
19 RETURN VARCHAR2;
20
21 PROCEDURE set_global_name(gdbname IN VARCHAR2);
22 -- in internal packages, we don't want to call PL/SQL to set from_remote,
23 -- hence, convert from_remote to a function.
24 -- clients are not supposed to assign values to this variable.
25 -- If they do, use set_from_remote(flag) instead.
26
27 PROCEDURE replication_on;
28 -- Turn on replication.
29
30 PROCEDURE replication_off;
31 -- Turn off replication.
32
33 FUNCTION replication_is_on
34 RETURN BOOLEAN;
35 -- If false, do not forward/defer the update.
36
37 --
38 -- Common procedures and functions shared by Repcat, deferred RPC, etc.
39 --
40 PROCEDURE canonicalize(name IN VARCHAR2,
41 canon_name OUT VARCHAR2,
42 canon_len IN NUMBER);
43 -- Canonicalize the string passed in as parameter name, determine the
44 -- longest prefix that fits in canon_len bytes, and return the result in
45 -- canon_name. Canonicalization is defined as follows. If name is NULL,
46 -- canon_name becomes NULL. If name begins and ends with a double quote,
47 -- remove both. Otherwise, convert name to upper case with NLS_UPPER.
48
49 --
50 -- Automatic conflict resolution logic.
51 --
52 PROCEDURE recursion_on;
53 -- Keep track of the number of recursion.
54
55 PROCEDURE recursion_off;
56 -- The number of recursion is initialized to zero.
57
58 PROCEDURE rep_begin(site_name IN VARCHAR2 default NULL);
59 -- Initialization at the beginning of each rep_delete, rep_insert, and
60 -- rep_update. It accepts the origin site name and assigns it to the
61 -- session variable, ugakos, if ugakos has not been initialized.
62
63 PROCEDURE rep_end;
64 -- Clean up at the end of each rep_delete, rep_insert, and rep_update,
65 -- including freeing up the memory that has been allocated to the session
66 -- variable, ugakos.
67
68 FUNCTION get_constraint_name(errmsg IN VARCHAR2)
69 RETURN VARCHAR2;
70 -- Return the name of the uniqueness contraint in the ORA error message.
71
72 FUNCTION minimum(new IN NUMBER,
73 cur IN NUMBER,
74 ignore_discard_flag OUT BOOLEAN)
75 RETURN BOOLEAN;
76 -- If new > cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
77 -- Return FALSE if any input parameter is null; otherwise return TRUE.
78
79 FUNCTION minimum(new IN VARCHAR2,
80 cur IN VARCHAR2,
81 ignore_discard_flag OUT BOOLEAN)
82 RETURN BOOLEAN;
83 -- If new > cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
84 -- Return FALSE if any input parameter is null; otherwise return TRUE.
85
86 FUNCTION minimum(new IN DATE,
87 cur IN DATE,
88 ignore_discard_flag OUT BOOLEAN)
89 RETURN BOOLEAN;
90 -- If new > cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
91 -- Return FALSE if any input parameter is null; otherwise return TRUE.
92
93 FUNCTION maximum(new IN NUMBER,
94 cur IN NUMBER,
95 ignore_discard_flag OUT BOOLEAN)
96 RETURN BOOLEAN;
97 -- If new < cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
98 -- Return FALSE if any input parameter is null; otherwise return TRUE.
99
100 FUNCTION maximum(new IN VARCHAR2,
101 cur IN VARCHAR2,
102 ignore_discard_flag OUT BOOLEAN)
103 RETURN BOOLEAN;
104 -- If new < cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
105 -- Return FALSE if any input parameter is null; otherwise return TRUE.
106
107 FUNCTION maximum(new IN DATE,
108 cur IN DATE,
109 ignore_discard_flag OUT BOOLEAN)
110 RETURN BOOLEAN;
111 -- If new < cur, then ignore_discard_flag is TRUE; otherwise it is FALSE.
112 -- Return FALSE if any input parameter is null; otherwise return TRUE.
113
114 FUNCTION average(new IN OUT NUMBER,
115 cur IN NUMBER,
116 ignore_discard_flag OUT BOOLEAN)
117 RETURN BOOLEAN;
118 -- Output new as the average of new + old.
119 -- Ignore_discard_flag is always FALSE.
120 -- Return FALSE if any input parameter is null; otherwise return TRUE.
121
122 FUNCTION additive(old IN NUMBER,
123 new IN OUT NUMBER,
124 cur IN NUMBER,
125 ignore_discard_flag OUT BOOLEAN)
126 RETURN BOOLEAN;
127 -- Output new as cur + (new - old). Ignore_discard_flag is always FALSE.
128 -- Return FALSE if any input parameter is null; otherwise return TRUE.
129
130 FUNCTION discard(ignore_discard_flag OUT BOOLEAN)
131 RETURN BOOLEAN;
132 -- Ignore_discard_flag is always TRUE.
133 -- Always return TRUE.
134
135 FUNCTION overwrite(ignore_discard_flag OUT BOOLEAN)
136 RETURN BOOLEAN;
137 -- Ignore_discard_flag is always FALSE.
138 -- Always return TRUE.
139
140 FUNCTION append_site_name(new IN OUT VARCHAR2,
141 str IN VARCHAR2,
142 max_len IN NUMBER,
143 ignore_discard_flag OUT BOOLEAN)
144 RETURN BOOLEAN;
145
146 FUNCTION append_site_name_nc(new IN OUT NVARCHAR2,
147 str IN VARCHAR2,
148 max_len IN NUMBER,
149 ignore_discard_flag OUT BOOLEAN)
150 RETURN BOOLEAN;
151 -- Output new with str appended to it. Ignore_discard_flag is always FALSE.
152 -- Return FALSE if any input parameter is null or the length of str plus one
153 -- is greater than max_len; otherwise return TRUE.
154
155 FUNCTION append_sequence(new IN OUT VARCHAR2,
156 max_len IN NUMBER,
157 ignore_discard_flag OUT BOOLEAN)
158 RETURN BOOLEAN;
159
160 FUNCTION append_sequence_nc(new IN OUT NVARCHAR2,
161 max_len IN NUMBER,
162 ignore_discard_flag OUT BOOLEAN)
163 RETURN BOOLEAN;
164 -- Output new with a sequence generated number appended to it.
165 -- Ignore_discard_flag is always FALSE.
166 -- Return FALSE if any input parameter is null or the length of the generated
167 -- number is greater than max_len; otherwise return TRUE.
168
169 PROCEDURE enter_statistics(sname IN VARCHAR2,
170 oname IN VARCHAR2,
171 conflict_type IN VARCHAR2,
172 reference_name IN VARCHAR2,
173 method_name IN VARCHAR2,
174 function_name IN VARCHAR2,
175 priority_group IN VARCHAR2,
176 primary_key_value IN VARCHAR2,
177 resolved_date IN DATE default SYSDATE);
178 -- Record that the given conflict has been resolved with the given
179 -- resolution.
180 -- Input parameters:
181 -- sname The name of the schema containing the table to be replicated.
182 -- oname The name of the table being replicated.
183 -- conflict_type The type of conflict. Valid values are: `UPDATE',
184 -- `UNIQUENESS', and `DELETE'.
185 -- reference_name If the conflict type is 'DELETE', enter the replicated
186 -- table name here. If the conflict type is `UPDATE', enter the column
187 -- group name here. If the conflict type is `UNIQUE CONSTRAINT', enter
188 -- the unique constraint name here.
189 -- method_name The conflict resolution method.
190 -- function_name If the method is 'USER FUNCTION', enter the user
191 -- resolution function name here.
192 -- priority_group If the method is `PRIORITY GROUP', enter the name of
193 -- priority group used for resolving the conflict.
194 -- primary_key_value The primary key value for the row whose conflict is
195 -- being resolved.
196 -- resolved_date The date at which the conflict is resolved.
197
198 PROCEDURE ensure_normal_status(canon_gname IN VARCHAR2,
199 canon_gowner IN VARCHAR2 default 'PUBLIC');
200 --- Raise exception quiesced_num (-23311) if the status of the object group
201 --- is not normal.
202
203 PROCEDURE raw_to_varchar2(r IN RAW,
204 offset IN BINARY_INTEGER,
205 v OUT VARCHAR2);
206 -- Select the "offset" bit in each byte of r, map a 0 to 'N' and a 1 to 'Y',
207 -- and put the result in v. Offset is 1-based and must be between 1 and 8,
208 -- inclusive.
209
210 PROCEDURE make_internal_pkg(canon_sname IN VARCHAR2,
211 canon_oname IN VARCHAR2);
212 -- Routine that ensures that repcat$_repobject.flag is correct for the given
213 -- table with respect to internal pkgs.
214
215 FUNCTION import_rep_trigger_string(arg IN VARCHAR2)
216 RETURN VARCHAR2;
217 -- Routine in sys.expact$ that generates a PL/SQL string that calls
218 -- sync_up_rep.
219
220 PROCEDURE sync_up_rep(canon_sname IN VARCHAR2,
221 canon_oname IN VARCHAR2);
222 -- Routine that ensures that sys.tab$.trigflag is correct for the given
223 -- table.
224
225 END dbms_reputil;