List of articles   Colour designations   Choose language


Table from database

Single table

There exist typical operation of looking database table: smaller quantity of records is shown in browser, bigger quantity is still not inquired from database. We enter html-element dialogue, displaying records of database table with slider on right side (that database table is demonstrated especially so, instead of representation as tree or cube, property type must be equal record). In attribute roll, we specify name of database table

<dialogue roll="A"/>

dialogue {
  type: record;
}
or SQL-request
<dialogue roll="select * from A where a15=100"/>

dialogue {
  type: record;
}
and in properties

Connection with database occurs via separate TCP-port by protocal SQL5. When browser meets this html-element during loading document, it: Note: field of view A refers to the same column of some table C, to which field of table B, entered into view, refers.

Displayed values are demonstrated so:


If user press "arrow-down" on last received record, then browser asks next portion by request
select * from A downward a1="v50_1" a2="v50_2" a3="v50_3" limit 50;
If user press "arrow-up" in first newly received record, then browser asks previous portion (which can be changed already in database)
select * from A upward a1="v100_1" a2="v100_2" a3="v100_3" limit 50;
If user tries to enter value into refering (to some master table) field, then new separate browser window appears with content of master table (user must choose record of master table). If user appends new record and fill all its obligatory cells (which are known from database scheme), and wait time, equal double-click, then browser immediately saves appended record. If user changes record, and wait time, equal double-click, then browser immediately saves new variants of record. If user deletes record (by button "Dell" in browser menu), then browser deletes it in DBMS.

Each 1-st click on column header orders to request portion of records from database, sorted by ascending, beginning from current record. Each 2-nd click - by descending.

Displaying of columns

CSS can make some columns non-displayed

dialogue §a2 {
  display: none;
}
Table columns are displayed in line with CSS, specified for them. Properties of columns can be equal to not only constant (as in CSS now), but to values of other columns too (it's necessary to specify name of xml-attribute, anticipated by sign "§", as value of property).
dialogue §a3 {
  color:   §a4;
  font:    §a5;
}

Property header specifies header for each column (by default header is equal to name of field in database).

dialogue §a3 {
  header:  "column header"
}

Following value of property path means, that "C" is master table for table "B", "B" is master table for field "§a2", and that browser visualize content of table "C" before in separate window to choose sub-set of table "B" (i.e. records of table "B", which refer to chosen record of table "C").

dialogue §a2 {
  path:  B C;
}

Duplication of fields in controls

Fields of current record (on which user's cursor is) can be duplicated in input - input must have the same value of attribute roll, as dialogue has, and must contain names of xml-attributes in attribute value (their attribute type is ignored, because is specified by database scheme). Changes, entered into current record, is displayed in input too; changes, entered into these input, is displayed in current record too.

<dialogue roll="A"/>
<input    roll="A" value="a1">
<input    roll="A" value="a2">
<input    roll="A" value="a3">

Relation "master-subordinate" between tables in one document

If master and slave table are displayed in two dialogue of one html-document, then only records, refering to current record of master table, are demonstrated in slave table.

<dialogue roll="M"/>
<dialogue roll="S"/>
If master and several slave tables are displayed each in separate dialogue of one html-document, then only records, refering to current records of master tables, are demonstrated in slave table.
<dialogue roll="M1"/>
<dialogue roll="M2"/>
<dialogue roll="M3"/>
<dialogue roll="S"/>

If slave table refers to master table by several own fields, then attribute influence of master dialogue specifies value of attribute id of slave dialogue, and attribute to of master dialogue specifies name of column of slave database table.

<dialogue roll="M" to="s3"/>
<dialogue roll="M" to="s5"/>
<dialogue roll="M" to="s7"/>
<dialogue roll="S"/>
<dialogue roll="M" influence="id1" to="s3"/>
<dialogue roll="S" id="id1"/>
<dialogue roll="S" id="id2/>
Besides this, it's possible to specify additional virtual columns for master table, property cultivate of which contains name of slave table, and property to - refering field of slave table. If user clicks on cell of so virtual column, new separate browser window appears with records of slave table, which refer to record of master table (to see all records of slave table, it's necessary to press button "All" in browser menu).
dialogue §m20::after               { cultivate:S;   to:s5 }
dialogue §m20::after::after        { cultivate:SS;  to:ss8 }
dialogue §m20::after::after::after { cultivate:SSS; to:sss7 }
Property to is unnecessary, if only one field of slave table refers to master table.
dialogue §m20::after {
  cultivate: S;
}

P.S.

dialogue with any value of property type (equal to record, tree, or cube) can be master html-element for dialogue with any value of property type. Html-document itself, requests from all dialogue, containing in it, answers to request go sequentially via the same TCP-connection (answers are separated from each other and from html-document by bament <?new/?>, answers come after end of accepting html-document).



Dmitry Turin



List of articles   Colour designations   Choose language