File: db_repl_pub_create.vspx

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 (162 lines) | stat: -rw-r--r-- 6,636 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $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
 -
 -
-->
<v:page name="db_repl_pub_create_page" decor="yacutia_decor.vspx" style="yacutia_style.xsl" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro">
  <vm:pagetitle>Virtuoso HTTP Database Replication</vm:pagetitle>
  <vm:pagewrapper>
    <vm:menu>
      <vm:menuitem value="Transactional Replication"/>
    </vm:menu>
    <vm:header caption="Create new replication publication"/>
    <vm:pagebody vdb_check="1">
      <table class="form_layout">
        <colgroup>
          <col/>
          <col/>
          <col/>
        </colgroup>
        <tr>
          <td class="page_tab_selected">
            Publications
          </td>
          <td class="page_tab">
            <v:url name="b_url13" value="--'Subscriptions'" format="%s" url="--'db_repl_trans.vspx?page=2'"/>
          </td>
        <td class="page_tab_empty"></td>
      </tr>
    </table>
    <table class="tab_page">
      <tr>
        <td>
      <v:form name="create_pub_frm" action="db_repl_pub_create.vspx" method="POST" type="simple">
        <table class="ctl_grp">
          <tr>
            <td class="ctl_lbl_ctr">Name</td>
            <td class="ctl_ctr">
              <v:text name="crpub_textfield" xhtml_rows="10"/>
            </td>
          </tr>
          <tr>
            <td class="ctl_lbl_ctr">Sync user</td>
            <td class="ctl_ctr">
              <select name="sync_user">
                <?vsp
                  for select U_NAME from DB.DBA.SYS_USERS where U_IS_ROLE = 0 and U_SQL_ENABLE = 1 order by U_NAME do
                  {
                    declare _sel varchar;
                    if (U_NAME = 'dba')
                      _sel := ' selected="true"';
                    else
                      _sel := '';
                    http (sprintf ('<option value="%V"%V>%V</option>',
                        U_NAME, _sel, U_NAME));
                  }
                ?>
              </select>
            </td>
          </tr>
          <tr>
            <td class="ctl_ctr" colspan="2">
              <input type="checkbox" name="is_updateable" value="" id="is_updateable"/>
              <label for="is_updateable">Updateable</label>
            </td>
          </tr>
          <tr class="form_cmd_row">
            <td colspan="2">
              <v:button action="simple" name="create_can_but" value="Cancel">
                <v:on-post>
                  <![CDATA[
                    http_request_status('HTTP/1.1 302 Found');
                    http_header(sprintf('Location: db_repl_trans.vspx?page=1&sid=%s&realm=%s\r\n', self.sid , self.realm));
                  ]]>
                </v:on-post>
              </v:button>
              <v:button action="simple" name="create_pub_but" value="Create">
                <v:on-post>
                  <![CDATA[
                    declare text vspx_field;
                    declare _acct, _log varchar;
                    text := control.vc_parent.vc_find_control('crpub_textfield');
                    _acct := text.ufl_value;
                    if (_acct <> '')
                    {
                      declare _is_updateable_kw varchar;
                      _is_updateable_kw := get_keyword('is_updateable', control.vc_page.vc_event.ve_params, null);
                      declare _is_updateable integer;
                      if (_is_updateable_kw is not null)
                        _is_updateable := 1;
                      else
                        _is_updateable := 0;
                      declare _sync_user varchar;
                      _sync_user := get_keyword ('sync_user', control.vc_page.vc_event.ve_params);
                      declare acct_len, ix, _c integer;
                      _acct := ucase(_acct);
                      acct_len := length(_acct);
                      while (ix < acct_len)
                      {
                        _c := aref(_acct, ix);
                        if (not((_c >= ascii('A') and _c <= ascii('Z')) or (_c >= ascii('0') and _c <= ascii('9'))))
                          aset(_acct, ix, ascii('_'));
                        ix := ix + 1;
                      }
                      _log := concat(_acct, '.log');

                      declare _sql_state, _sql_msg varchar;
                      _sql_state := '00000';
                      exec('REPL_PUBLISH(?, ?, ?, ?)', _sql_state, _sql_msg, vector(_acct, _log, _is_updateable, _sync_user)  );
                      if ( _sql_state <> '00000') {
                        self.vc_error_message := _sql_state || ': ' || _sql_msg;
                        self.vc_is_valid := 0;
                        return;
                      };

                      REPL_PUBLISH(_acct, _log, _is_updateable, _sync_user);
                      http_request_status('HTTP/1.1 302 Found');
                      http_header(sprintf('Location: db_repl_trans.vspx?page=1&sid=%s&realm=%s\r\n', self.sid , self.realm));
                    }
                    else
                    {
                      self.vc_error_message := 'Please specify publication name';
                      self.vc_is_valid := 0;
                      return;
                    }
                  ]]>
                </v:on-post>
              </v:button>
            </td>
          </tr>
        </table>
        <span class="listing_hdr_qual">
          Type name of publication and click <b>Create</b><br/>
          to continue. Note: Any lowercase characters will be transformed<br/>
          to uppercase. Any spaces will become underscores.
        </span>
      </v:form>
        </td>
      </tr>
    </table>
    </vm:pagebody>
  </vm:pagewrapper>
</v:page>