File: trx_repl_item_add.vsp

package info (click to toggle)
virtuoso-opensource 6.1.6%2Bdfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (295 lines) | stat: -rw-r--r-- 10,809 bytes parent folder | download | duplicates (2)
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?vsp 
--
--  $Id$
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2012 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  

 adm_pre_page(lines);

--no_c_escapes-
declare _acct, _action, _item varchar;
declare _dav, _tbl, _proc, _qual, _sel, _dsel varchar;
declare _idx integer;

if (not adm_check_auth (lines)) {adm_tell_unauth(lines); return (0);}
_acct := get_keyword ('acct', params, '');
_qual := get_keyword ('qual', params, '');
_action := get_keyword ('additem', params, '');
_sel := get_keyword ('sel_all', params, '');
_dsel := get_keyword ('desel_all', params, '');
if (_sel <> '')
  _sel := 'checked';
if (_qual = '' and _action = '' and '' = get_keyword ('grnt', params, '') and _sel = '')
  {
?>

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <link rel="stylesheet" type="text/css" HREF="<?=adm_what_css()?>">
    <meta name="AUTHOR" content="OpenLink Software">
    <meta name="DESCRIPTION" content="Transactional replication wizard - databases list">
    <title>Transactional replication Database Selection</title>
  </head>
<?vsp adm_page_header('Transactional Replication', NULL); ?>

      <p>select database to add replication for any table or procedure</p>

<TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
        <tr>
	  <td CLASS="genlistheadt">Databases</td>
	</tr>
	<?vsp for (select distinct name_part (key_table, 0, 'DB') as qual from sys_keys) do { ?>
	  <tr>
	      <td CLASS="gendata"><a class="tablelistaction" href="trx_repl_item_add.vsp?qual=<?=qual?>&acct=<?=_acct?>"><?=qual?></a></td>
	  </tr>
	<?vsp } ?>
      </table>
<?vsp adm_page_footer(); ?>
</html>

<?vsp
  }
 else if (_action = '' and _qual <> '' and '' = get_keyword ('grnt', params, ''))
  {
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <link rel="stylesheet" type="text/css" HREF="<?=adm_what_css()?>">
    <meta name="AUTHOR" content="OpenLink Software">
    <script language="javascript" src="../admin_utils.js"></script>
    <meta name="DESCRIPTION" content="Transactional replication wizard - tables and procedures list">
    <title>Tables and Procedures</title>
  </head>
<?vsp adm_page_header(concat('Tables and Procedures on Database ', _qual), NULL); ?>
<?include ../adm_js_check.vsp ?>

      <p>Select &quot;Add to publication&quot; to add table(s) and/or procedure(s) to publication  <b>"<?=_acct?>"</b></p>

    <form method=POST action="trx_repl_pub_items.vsp">
    <input type=hidden name="acct" value="<?/_acct?>">
    <input type=hidden name="qual" value="<?/_qual?>">
      <table border=0>
      <input type=button name=selall value="Select All" onClick="selectAllCheckboxes(this.form, this)">
        <tr>
          <td valign=top width="50%">
<TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
	      <tr>
	        <td CLASS="genlistheadt">Table</td>
	        <td CLASS="genlistheadt">Repl</td>
	        <td CLASS="genlistheadt">Sel</td>
	      </tr>
	      <?vsp
	        declare len integer;
	        len := 0;
	        for select distinct key_table as tblname
		     from sys_keys
		     where
		       name_part (key_table, 0) = _qual and
		       not exists (select 1 from sys_views where v_name = key_table) and
		       name_part (key_table, 2) not like 'RLOG_%'
		       and name_part (key_table, 2) not like 'SYS_%'
		       order by name_part (key_table, 0)
	        do
		  {
                    if (table_type (tblname) = 'SYSTEM TABLE')
                      goto next_t;

		    if (exists (select 1 from DB.DBA.SYS_VT_INDEX where VI_INDEX_TABLE = tblname))
                      goto next_t;

		    if (tblname like '%_HIT' and exists
			(select 1 from DB.DBA.SYS_VT_INDEX where tblname = concat (VI_TABLE,'_',VI_COL,'_HIT')))
		      goto next_t;
		    if (tblname like '%_QUERY' and exists
			(select 1 from DB.DBA.SYS_VT_INDEX where tblname = concat (VI_TABLE,'_',VI_COL,'_QUERY')))
		      goto next_t;
		    if (tblname like '%_USER' and exists
			(select 1 from DB.DBA.SYS_VT_INDEX where tblname = concat (VI_TABLE,'_',VI_COL,'_USER')))
		      goto next_t;



		    len := len + 1;
                    if (exists (select 1 from SYS_TP_ITEM where TI_SERVER = repl_this_server () and
			  TI_ITEM = tblname and TI_TYPE = 2))
		        http(sprintf('<tr><td CLASS="gendata">%s.%s.%s</td><td CLASS="gendata"><b>Yes</b></td><td><input type=checkbox name="TB_%V"></td></tr>\n',
		         name_part(tblname, 0), name_part(tblname, 1), name_part(tblname, 2), tblname));
		    else
		        http(sprintf('<tr><td CLASS="gendata">%s.%s.%s</td><td CLASS="gendata">No</td><td><input type=checkbox name="TB_%V" %s></td></tr>\n',
		         name_part(tblname, 0), name_part(tblname, 1), name_part(tblname, 2), tblname, _sel));
		    next_t:;
		  }
	        if (0 = len)
		  http (sprintf ('<tr><td colspan="3" CLASS="gendata">No tables defined for %s.</td></tr>', _qual));
	      ?>
	    </table>
	  </td>
	 <td valign=top width="50%">
<TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
	      <tr>
	        <td CLASS="genlistheadt">Procedure</td>
	        <td CLASS="genlistheadt">Repl</td>
	        <td CLASS="genlistheadt">Sel</td>
	      </tr>
         <?vsp
	 len := 0;
         for select P_QUAL as pq, P_NAME as proc from SYS_PROCEDURES where 0 = casemode_strcmp (name_part (P_NAME, 0), _qual) order by P_NAME do
            {
		-- FTi procedures
		if (
			proc like '%.TT_NOTIFY_%' or
			proc like '%.TT_QUERY_%' or
			proc like '%.TT_WORD_%' or
			proc like '%.TT_XPATH_%' or
			proc like '%.VT_BATCH_PROCESS_%' or
			proc like '%.VT_BATCH_REAL_PROCESS_%' or
			proc like '%.VT_HITS_%' or
			proc like '%.VT_INDEX_%' or
			proc like '%.VT_INSERT_1_%' or
			proc like '%.VT_NEXT_CHUNK_ID_%' or
			proc like '%.VT_PROCESS_WORD_BATCH_%' or
			proc like '%.VT_INC_INDEX_%'
		   )
		goto next_p;

	        len := len + 1;
		if (not exists (select 1 from SYS_TP_ITEM where TI_SERVER = repl_this_server () and
			   TI_ITEM = proc and TI_TYPE = 3))
	        http(sprintf('<tr><td CLASS="gendata">%s</td><td CLASS="gendata">No</td><td><input type=checkbox name="PR_%V" %s></td></tr>\n', proc, proc, _sel)) ;
		else
	        http(sprintf('<tr><td CLASS="gendata">%s</td><td CLASS="gendata"><b>Yes</b></td><td><input type=checkbox name="PR_%V"></td></tr>\n', proc, proc));
	        next_p:;
	    }
	        if (0 = len)
		  http (sprintf ('<tr><td colspan="3" CLASS="gendata">No procedures defined for %s.</td></tr>', _qual));

        ?>
	    </table>
	</td>
        </tr>
        <tr>
          <td colspan=2 align="right">
	    <input type=submit name="add_to_pub" value="Add to publication">
	  </td>
        </tr>
      </table>
    </form>
<?vsp adm_page_footer(); ?>
</html>
<?vsp
  }
 else if (_action <> '' and _qual <> '' and '' = get_keyword ('grnt', params, ''))
 {
?>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <link rel="stylesheet" type="text/css" HREF="<?=adm_what_css()?>">
    <meta name="AUTHOR" content="OpenLink Software">
    <meta name="DESCRIPTION" content="Transactional replication wizard - databases list">
    <title>Transactional Replication Items Add</title>
  </head>
<?vsp adm_page_header('Transactional Replication Items Add', NULL); ?>

      <p>Confirm replication on these items to "<?=_acct?>"</p>

    <form action="trx_repl_pub_items.vsp" method=post name="frm_conf">
    <input type=hidden name="acct" value="<?/_acct?>">
<TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
        <tr>
	  <!--td CLASS="genlistheadt">Sel</td-->
	  <td CLASS="genlistheadt">Items</td>
	  <td CLASS="genlistheadt">Type</td>
	</tr>
<?vsp _idx := 0; while (_item := adm_next_checkbox ('TB_', params, _idx)) { ?>
	  <tr>
	      <td CLASS="gendata"><a class="tablelistaction" href=#><?=_item?></a></td><td>Table</td>
              <input type=hidden name="TBL" value="<?=_item?>">
	  </tr>
	<?vsp } ?>
<?vsp _idx := 0; while (_item := adm_next_checkbox ('PR_', params, _idx)) { ?>
	  <tr>
	      <td CLASS="gendata"><a class="tablelistaction" href=#><?=_item?></a></td><td CLASS="gendata">PL/SQL Procedure</td>
              <input type=hidden name="PROC" value="<?=_item?>">
	  </tr>
	<?vsp } ?>

      </table>
      <table border=0>
      <tr><td><input type=submit name="add_to_pub1" value="Add to publication"></td></tr>
      </table>
      </form>
<?vsp
  }
else if ('' <> get_keyword ('grnt', params, ''))
  {
?>

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <link rel="stylesheet" type="text/css" HREF="<?=adm_what_css()?>">
    <meta name="AUTHOR" content="OpenLink Software">
    <meta name="DESCRIPTION" content="Transactional replication wizard - databases list">
    <title>Transactional Replication Grants</title>
    <script language="javascript" src="../admin_utils.js"></script>
  </head>
<?vsp adm_page_header('Transactional Replication Grants', NULL); ?>
<?include ../adm_js_check.vsp ?>

      <p>To grant subscribe to "<?=_acct?>" select some user(s) and click <b>Grant</b></p>

    <form action="trx_repl_pub_items.vsp" method=post name="frm_grant">
    <input type=hidden name="acct" value="<?/_acct?>">
<TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
        <tr>
	  <td CLASS="genlistheadt">User Name</td>
	  <td CLASS="genlistheadt">
            <input type="checkbox" name="selectall" value="Select All" onClick="selectAllCheckboxes(this.form, this)">
	</td>
	</tr>
       <?vsp
       declare ulen integer;
       ulen := 0;
       for select U_NAME from SYS_USERS where U_ID <> 0 and U_SQL_ENABLE = 1 and U_IS_ROLE = 0 and
	 (not exists (select 1 from SYS_TP_GRANT where TPG_ACCT = _acct and TPG_GRANTEE = U_NAME))
	     order by U_NAME
	 do {
              ulen := ulen + 1;
	   ?>
	  <tr><td CLASS="gendata"><?=U_NAME?></td><td><input type=checkbox name="GR_<?/U_NAME?>"></td></tr>
      <?vsp
	    }
        if (ulen = 0)
          http ('<tr><td colspan=2>** No users defined **</td></tr>');
      ?>
      <tr><td colspan="2" align="right"><input type=submit name="add_grant" value="Grant"></td></tr>
      </table>
      </form>
<?vsp adm_page_footer(); ?>

<?vsp
  }
?>

</html>