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
|
<?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
--
--
?>
<HTML>
<head>
<title>Table manipulations calling CLR functions</title>
</head>
<body>
<H2>Table manipulations calling CLR functions</H2>
<?vsp
{
declare _ClientSerialNo, _SMSKey, _Recepient varchar;
_ClientSerialNo := registry_get ('ho_s_3.Redcoal.ClientSerialNo');
_SMSKey := registry_get ('ho_s_3.Redcoal.SMSKey');
_recepient := registry_get ('ho_s_3.MGRPhone');
if (isstring (_ClientSerialNo) and isstring (_SMSKey) and isstring (_recepient) and
length (_ClientSerialNo) > 0 and length (_SMSKey) > 0 and length (_recepient) > 0)
{
?>
<p><i>SMS Sending <a href="setup_sms.vsp">on</a></i></p>
<?vsp
} else {
?>
<p><i>SMS Sending <a href="setup_sms.vsp">off</a></i></p>
<?vsp
}
}
declare _add_it, _delete_it integer;
declare _supplier_id varchar;
declare exit handler for sqlstate '*' {
?>
<hr/>
<table>
<tr>
<td>SQL State</td>
<td><?= __SQL_STATE ?></td>
</tr>
<tr>
<td>SQL Message</td>
<td><?= __SQL_MESSAGE ?></td>
</tr>
</table>
<hr/>
<?vsp
goto page_start;
};
_supplier_id := trim (get_keyword ('supplier_id', params, ''));
_add_it := trim (get_keyword ('add_it', params, ''));
_delete_it := trim (get_keyword ('delete_it', params, ''));
if (_add_it <> '')
{
insert soft CLR..Suppliers (SupplierID) values (cast (_supplier_id as integer));
?>
<hr/>
<p>Added : SupplierID <b><?= cast (_supplier_id as integer) ?></b>.</p>
<hr/>
<?vsp
}
else if (_delete_it <> '')
{
delete from CLR..Suppliers where SupplierID = cast (_supplier_id as integer);
?>
<hr/>
<p>Deleted : SupplierID <b><?= cast (_supplier_id as integer) ?></b>.</p>
<hr/>
<?vsp
}
page_start:
?>
<form action="handler.vsp">
<table>
<tr>
<td>
SupplierID
</td>
<td>
<select name="supplier_id" value="<?= _supplier_id ?>">
<?vsp
for select SupplierID as supp_id from CLR..Suppliers do {
?>
<option label="<?= supp_id ?>" value="<?= supp_id ?>"><?= supp_id ?></option>
<?vsp }
?>
</select>
</td>
<td><input type="submit" name="delete_it" value="Delete"></td>
</tr>
</table>
</form>
<hr/>
<form action="handler.vsp">
<table>
<tr>
<td>
New SupplierID
</td>
<td>
<input type="text" name="supplier_id" value="<?= _supplier_id ?>">
</td>
<td><input type="submit" name="add_it" value="Add"></td>
</tr>
</table>
</form>
</body>
</html>
|