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
QueryErmAttr
(OLE Functions for MS Word)


Vytvořeno: 01-06-1997 16:32:07
Poslední změna: 11-28-2002 10:07:42

Outputs information about entity types and their connections shown in the specified ER model; the amount of information on attributes can be customized by parameters.

Modul

Module: OLE Functions for MS Word

Zdrojový kód:

PROCEDURE QueryErmAttr(diagname$, which$)
BEGIN

    PRINT {"Arial", 12, BOLD} "Atributey v ER-modelu ";
    FOR Erarea WHERE Name = diagname$ DO
        PRINT {"Arial", 12, BOLD, ITALIC} CONV$(Boxname);
    END
    PRINT {"Arial", 12, BOLD} NL(2);
    // for each entity
    FOREACH Enode WHERE Area = diagname$
                  ORDER BY Entity DO
        FOR Entity WHERE Name = Enode.Entity DO
            PRINT {"Arial", 10, BOLD} CONV$(Boxname), NL;
        END
        FOREACH ERConnection WHERE ERConnection.Entity=Enode.Entity
                             AND ERConnection.Cardinality="sz" DO
            RshipID%=ERConnection.Rship;
            PRINT {"Arial", 8} TAB(4),"Specialization of ";
            FOR ERConnection WHERE ERConnection.Rship=RshipID%
                             AND ERConnection.Cardinality="ge" DO
                
                FOR Entity WHERE Entity.Name=ERConnection.Entity DO
                    PRINT {"Arial", 8, BOLD} CONV$(Entity.Boxname);
                    PRINT NL;
                END
            END
        END
        
        found%=0;
        addtab%=4;
        PRINT TAB(4);
        PRINT {"Arial", 8, BOLD} "Atributy", NL;
 
        // print all attributes
        FOREACH Attribute WHERE Entity = Enode.Entity ORDER BY Position DO
            found%=1;
            PRINT TAB(4+addtab%);
            Pkey%=0;
            FOREACH Identifierattribute WHERE Attribute.Name=Attribute
                                        AND Enode.Entity=Entity DO
                Pkey%=1;
            END
            PRINT {"Arial", 8} Name;
            IF INSTR(which$, "d") > 0 AND Data <> "" THEN
                FOR Data WHERE Name=Attribute.Data DO
                    PRINT {"Arial", 8} TAB(25+addtab%), Boxname;
                END
            END
            IF INSTR(which$, "t") > 0 THEN
                CALL Dataelementtype(Data, Typename$);
                IF Typename$ <> "" THEN
                    PRINT {"Arial", 8} TAB(50+addtab%), Typename$;
                END
            END
            PRINT NL;
        END
        IF found%=0 THEN
            PRINT {"Arial",10,ITALIC} TAB(4+addtab%),"Neexistují atributy.",NL;
        END
        PRINT NL;
        // if needed print the keys
        IF INSTR(which$, "k") > 0 THEN
            PRINT TAB(4);
            PRINT {"Arial", 8, BOLD} "Klíče", NL;
            foundKey%=0;
            FOREACH Identifier WHERE Entity = Enode.Entity ORDER BY Entity DO
                foundAttrKey%=0;
                foundKey%=1;
                PRINT TAB(8);
                PRINT {"Arial", 8, UNDERLINE} Name;
                FOR Entity WHERE Name = Identifier.Entity
                        AND Primaryidentifier = Identifier.Name DO
                   PRINT {"Arial", 8} " (primární klíč)";
                END
                PRINT NL;
                // loop over the attributes and sort them by position
                FOREACH Attribute WHERE Entity = Identifier.Entity
                     ORDER BY Position DO
                     // check if this attribut is in the current key
                     FOR Identifierattribute WHERE Entity = Identifier.Entity
                        AND Identifier = Identifier.Name
                        AND Attribute = Attribute.Name DO
                        PRINT TAB(12);
                        foundAttrKey%=1;
                        PRINT {"Arial", 8} Attribute.Name;
                        IF INSTR(which$, "d") > 0 AND Data <> "" THEN
                            FOR Data WHERE Name=Attribute.Data DO
                                PRINT {"Arial", 8} TAB(29), Boxname;
                            END
                        END
                        IF INSTR(which$, "t") > 0 THEN
                            CALL Dataelementtype(Attribute.Data, Typename$);
                            IF Typename$ <> "" THEN
                                    PRINT {"Arial", 8} TAB(54), Typename$;
                            END
                        END
                        PRINT NL;
                    END
                END
                FOREACH Identifiererconnection WHERE Entity = Enode.Entity
                        AND Identifier=Identifier.Name
                        ORDER BY Refentity DO
                    FOR Entity WHERE Name=Identifiererconnection.Refentity DO
                        foundAttrKey%=1;
                        PRINT {"Arial", 8} TAB(12),"závisející na entitě ";
                        PRINT {"Arial", 8, BOLD} CONV$(Boxname);
                        PRINT NL;
                    END
                END
                IF foundAttrKey%=0 THEN
                    PRINT {"Arial",10,ITALIC} TAB(12),"Klíč nemá atributy.",NL;
                END
            END
            IF foundKey%=0 THEN
                PRINT {"Arial",10,ITALIC} TAB(8),"Žádný klíč.",NL;
            END
        END
        PRINT NL;
        
      // Description of attributes
        IF INSTR(which$,"c") > 0 THEN
            found% = 0;
            FOREACH Attribute WHERE Entity = Enode.Entity ORDER BY Position DO
                IF Text <> "" THEN
                    IF found% = 0 THEN
                        found% = 1;
                        PRINT {"Arial", 8, BOLD} "Popis atributu", NL(2);
                    END
                    PRINT {"Arial", 8} Name, ": ", NL;
                    PRINT Text, NL;
                END
            END
        END
        PRINT NL;
        
    END

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\32379.htm (C) microTOOL GmbH 2002