Database Reference
In-Depth Information
operators with the values in the list L received from
M
U
)
and
,
successively
,
to the
evaluation functor Eval
DB
(
in Proposition
24
).
Thus
,
any execution of such an Application Plan in
M
R
is an arrow f
DB
:
:
RA
→
A
→
A
1
in
DB
,
where A is the instance-database of a schema
in the data-memory of
M
R
before the execution of this plan while A
1
is the instance-database of the same
schema
A
A
in the data-memory of
M
R
after the execution of this plan
.
Proof
Using the functor
Eval
DB
(in Proposition
24
), we have demon-
strated that each
Σ
RE
-algebra tree-term
t
R
(a full relational algebra term) may be
represented by the equivalent arrow
f
k
:
:
RA
→
f
k
(t
RA
)
in
RA
where
t
RA
is a term
with variables (i.e., relational names of a given database schema
t
RA
→
A
) and binary op-
erator
(i.e.,
'EXTEND. . . '), while
f
k
is a composition of the unary operators in
Σ
RA
. Conse-
quently, we obtained from Proposition
24
that
Eval
corresponds to the evaluation
of such terms in the database category
DB
, where each relational name
r
i
(a vari-
able) in
t
R
is substituted by its current extension (a relational table)
R
i
=
⊗
(Cartesian product 'TIMES') and the unary operators _
a,name,e
r
i
#
,
and to each variable '
e
' in a unary operator _
a corresponding value is
assigned in the received list
L
(in the tuple
(n,
0
,L)
in its I/O memory) from
M
U
.
After that the relation
R
a,name,e
=
Eval(t
R
)
is evaluated and, finally, the function (i.e., a
composed operator)
f
R
is applied to it. In fact, in
M
R
this computation is done
just in this ordering. The obtained relation
R
Eval(t
R
)
will be temporarily saved
in the system memory of
M
R
and after that the relation
R
=
=
f
R
(R)
is com-
puted:
•
If
f
R
is a part of the Application Plan of an 'SELECT...' statement (in the
original source program
P
then the triple
(
0
, err,R
)
is saved in I/O memory, to
be transmitted to the host
M
U
machine.
•
Otherwise (the update SQL statements), the old relation (used in this SQL state-
ment) of the database in the data memory of
M
R
will be replaced by its updated
version
R
.
Let us show that any execution of an arrow
f
k
:
f
k
(t
RA
)
(obtained from
an Application Plan by binding the bounded variables in its variable-binding op-
erators with the values in the list
L
received from
M
U
)in
RA
is just an arrow
f
DB
:
A
→
A
1
in
DB
, where
A
is the instance-database of a given schema
t
RA
→
in
the data-memory of
M
R
before the execution of this plan, and
A
1
is the instance-
database of the same schema
A
A
in the data-memory of
M
R
after the execution of
this plan:
1. If the Application Plan is obtained from an update SQL statement, the proof for
this is given in Corollary
17
, Sect.
5.3
.
2. If the Application Plan is obtained from a 'SELECT...' statement of SQL then
we obtain the following: The term
t
R
is then only the Cartesian product of re-
lational symbols in the schema
A
of this database, that is,
t
R
=
r
i
1
⊗···⊗
r
i
n
,
with a list
L
R
=
r
i
1
,...,r
i
n
, such that we can have the same relational symbol
of
repeated at different positions in this list. Let the current instance-database
in data memory of
M
R
be
A
A
α
∗
(
=
A
)
, and hence the extension of each
r
i
k
is