Just a little remark: the createDatabase.rex example uses in its 
create-statements "not null", but
supplies default values being empty strings.

>From a database conceptual view this is illogical: NULL represents the missing 
>of information and
obviously the empty string represents missing information as well. The problem 
however: one cannot
distinguish anymore between an empty string that the user supplied from a 
missing value (the user
has not supplied any value) anymore!

So the suggestion would be to leave out the default '' part to re-enable the 
ability to find those
records in which values are truly missing, i.e. are NULL. Only use NOT NULL for 
columns that must
have a value under all conditions (i.e. for all candidate primary keys).

---

As your tables possess foreign key relationships to the "contacts" table, it 
might be helpful to
define foreign key relationships from the tables "addresses" and 
"TABLE_phone_num" to the table
"contacts", cf. <http://www.sqlite.org/foreignkeys.html>. Probably something 
like (untested):

    ...
    CREATE TABLE addresses (
       ...
       , *FOREIGN KEY(contact_id) REFERENCES contacts(id) ON UPDATE CASCADE ON 
DELETE CASCADE
       *, *FOREIGN KEY(type_id) REFERENCES addr_type(addr_type_id) ON UPDATE 
CASCADE ON DELETE RESTRICT*
    );*


    *CREATE TABLE TABLE_phone_num (
       ...
       , *FOREIGN KEY(contact_id) REFERENCES contacts(id) **ON DELETE CASCADE*
    );

In the above table there is a column "type_id": what kind of a type id is this? 
Does the value (if
given) refer to an existing value in another table (being a foreign key then)? 
Or is this line just
a copy & paste oversight?

    CREATE TABLE inet_addr (
       ...
       , *FOREIGN KEY(contact_id) REFERENCES contacts(id) **ON DELETE CASCADE*
    *   *, *FOREIGN KEY(type_id) REFERENCES addr_type(addr_type_id) ON UPDATE 
CASCADE ON DELETE RESTRICT*
     );

    ...

Please keep up your excellent work!

---rony

P.S.: Many years ago (actually about twenty years ago) I held lectures on 
relational databases
(Oracle, DB2, SQLServer) and wrote even a little book on designing relational 
models and introducing
SQL. The NULL concept turned out to be one that needed special attention, hence 
this preliminary
feedback. (Sorry, have not been able to run the samples and study the classes 
and APIs yet.)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to