Displaying of table 3x100 of DBMS
as table 10x10
3 database tables into 1 browser table
Let's consider a typical table
(we shall name such "wide" tables as multi-dimensional).
| |
home |
horse |
car |
yacht |
| Smith |
250 |
70 |
50 |
180 |
| Tomson |
340 |
|
90 |
100 |
| Johnson |
100 |
|
10 |
210 |
|
Multi-dimensional table is stored in a database as three tables
(we shall name them as relational).
One (here - table "cost") contains records with three fields:
identifier of row, identifier of column (primary key consist of two fields) and value for cell.
Two others (here - "things" and "family" tables) contains records with three fields too:
identifier of row or column (primary key),
serial number for visualization of display and name of row (or column).
cost
| person |
goods |
many |
| 11 |
101 |
250 |
| 11 |
52 |
70 |
| 11 |
23 |
50 |
| 11 |
84 |
180 |
| 72 |
101 |
340 |
| 72 |
23 |
90 |
| 72 |
84 |
100 |
| 43 |
101 |
100 |
| 43 |
23 |
10 |
| 43 |
84 |
210 |
|
things
| pk |
ser |
what |
| 101 |
1 |
home |
| 52 |
2 |
horse |
| 23 |
3 |
car |
| 84 |
4 |
yacht |
|
family
| pk |
ser |
who |
| 11 |
1 |
Smith |
| 72 |
2 |
Tomson |
| 43 |
3 |
Johnson |
|
We put tag tside inside table,
to notify browser, that this table is special.
We place tags, name of which are not important,
inside
thead,
tside,
tbody.
Tag, enclosed into tbody, i.e. 'cost' will not be displayed,
if it is intended for row or column, which does not exist.
<table>
<thead>
<things pk="101" what="home">
<things pk="52" what="horse">
<things pk="23" what="car">
<things pk="84" what="yacht">
</thead>
<tside>
<family pk="11" who="Smith">
<family pk="72" who="Tomson">
<family pk="43" who="Johnson">
</tside>
<tbody>
<cost person="11" goods="101" many="250">
<cost person="11" goods="52" many="70">
<cost person="11" goods="23" many="50">
<cost person="11" goods="84" many="180">
<cost person="72" goods="101" many="340">
<cost person="72" goods="23" many="90">
<cost person="72" goods="84" many="100">
<cost person="43" goods="101" many="100">
<cost person="43" goods="23" many="10">
<cost person="43" goods="84" many="210">
</tbody>
</table>
thead {
pk: §pk;
attract: §goods;
content: §what;
}
tside {
pk: §pk;
attract: §person;
content: §who;
}
tbody {
content: §many;
}
It's easy to get such constructions by SQL-requests like the following
(language
SQL5
is more adapted for that)
select '<table><thead>'
union
select '<things pk=' + pk + ' what=' + what + '>' from things order by ser
union
select '</thead><tside>'
union
select '<family pk=' + pk + ' who=' + who + '>' from family order by ser
union
select '</tside><tbody>'
union
select '<cost person=' + person + ' goods=' + goods + ' many=' + many + '>' from cost
union
select '</tbody></table>';
Sending of form
If
then browser sends following XML-text
<cost person="11" goods="52" many="80">
<cost person="43" goods="101" many="110">
Dmitry Turin
Chat.Ru ðåêîìåíäóåò:
Ïðîèçâîäèòåëè,
òîâàðû,
îáîðóäîâàíèå:
Êèòàé,
Èíäèÿ,
ßïîíèÿ,
Ñèíãàïóð
Òàéâàíü