Informační tok Funkční structura Datová struktura ER model Modulová struktura Typová struktura Relační model Dokumentace


[Celkový datový model] [Funkce] [Externí rohraní] [Stavové diagramy] [Datové elementy] [Entity] [Relace]
[Databáze] [Události] [Materiály] [Generovací funkce] [Vyhodnocovací funkce] [Konfigurace] [Uživatelé] [Projekt] [Home]



Vyhodnocovací funkce
Relationships_without_index
(Review-Manager Data model checks)


Vytvořeno: 12-13-1999 12:22:50
Poslední změna: 12-10-2002 11:10:57

Outputs all relationships in the relational model, where the target relation has no index. Many-to-many-relationships are ignored.

Modul

Module: Review-Manager Data model checks

Zdrojový kód:

PROCEDURE Relationships_without_index()
BEGIN

    PRINT "Relační vztah", NL;
    
    //select all relationships order by Name
    FOREACH Relrship WHERE Relrship.Cardinality <> "nm" AND
                           Relrship.Cardinality <> "mx" AND
                           Relrship.Cardinality <> "xm" AND
                           Relrship.Cardinality <> "xx"
                               ORDER BY Source, Name, Target DO

        relRshipAttrs% = 0;
        // Get the number of the attribute of the relationships
        FOREACH Relrshipattribute AS RSA WHERE RSA.Rship = Relrship.Name AND
                                               RSA.Source = Relrship.Source AND
                                               RSA.Target = Relrship.Target DO
            relRshipAttrs% = count();
            BREAK;
        END // FOREACH Relrshipattribute AS RSA
        
        IF relRshipAttrs% <> 0 THEN

            indexFound! = FALSE;
            //Select all indices, that belongs to the target relation in the relationship
            FOREACH Index WHERE Index.Relation= Relrship.Target AND
                                Index.Type = 0
                          ORDER BY Name DO
    
                indexFound! = TRUE;
                
                //select all attributes of the index
                FOREACH IndexAttribute WHERE IndexAttribute.Relation = Index.Relation AND
                                             IndexAttribute.Index = Index.Name DO
                                
                    //if the number of Indexattribute <> number of attribute of the relationship ->
                    IF count() <> relRshipAttrs% THEN
                        indexFound! = FALSE;
                        BREAK;
                    END // IF
    
                    // Is the index attribute a relationship attribute?
                    attrFound! = FALSE;
                    FOR Relrshipattribute AS RSA WHERE RSA.Rship = Relrship.Name AND
                                                       RSA.Source = Relrship.Source AND
                                                       RSA.Target = Relrship.Target AND
                                                       RSA.Targetattribute = Indexattribute.Attribute DO
                        attrFound! = TRUE;
                    END // FOR
                    IF NOT attrFound! THEN
                        indexFound! = FALSE;
                        BREAK;
                    END // IF
                    
                END // FOREACH Indexattribute
                
                IF indexFound! THEN
                    BREAK;
                END // IF
    
            END // FOREACH Index
    
            IF NOT indexFound! THEN
                CALL Util_PrintRelrship(Relrship.Tid, "", "", FALSE);
            END // IF
        END
    END // FOREACH Relrship
    
END


Generováno: 16.10.2003 7:41 Systém: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\Projekt03.csf Generováno systémem case/4/0
Vygeneroval: Administrator Soubor: C:\Documents and Settings\hajsman\Dokumenty\Vyuka\Irs2\Projekt case40\html\517967424.htm (C) microTOOL GmbH 2002