Download Datalog Educational System V3.3 User`s Manual

Transcript
Universidad Complutense de Madrid
Datalog Educational System
answer(2,3),
answer(2,4),
answer(3,4)
}
Info: 6 tuples computed.
5.1.9
Integrity Constraints, ODBC Connections, and Persistency
Integrity constraints as described in Section 4.1.15 are monitored by DES for the
local deductive database. This means that inserting values directly into external tables
(either by submitting an INSERT INTO statement from the opened connection or by
inserting values out of DES) is not monitored for constraint consistency. However, as
constraint consistency checking considers all visible data, when asserting into the local
database, data from the current opened connection is also taken into account. The
following system session shows a possible scenario illustrating these situations:
DES> /use_db $des
DES> create or replace table t(a int primary key)
DES> /dbschema
Info: Database '$des'
Info: Table(s):
* t(a:number(integer))
- PK: [a]
Info: No views.
Info: No integrity constraints.
DES> /open_db mysql
Table 't' is also an external table in connection 'mysql':
DES> /dbschema t
Info: Database 'mysql'
Info: Table:
* t(a:integer(4))
Retrieve tuples from external table 't':
DES> select * from t
answer(a:integer(4)) ->
{
}
Info: 0 tuples computed.
The following is inserted in external table 't'. Recall that SQL statements under
an opened connection are submitted directly to the external RDBMS:
DES> insert into t values (1)
Info: 1 tuple inserted.
DES> insert into t values (1) % Not rejected as it is not
monitored by DES
Info: 1 tuple inserted.
DES does monitor the following assertion as it is directed to the local database:
DES> /assert t(1)
Error: Primary key violation t.[a]
Fernando Sáenz-Pérez
112/228