E N D
The database An introduction to the catalogs
One of the neat things about a relational database system is that the internal schema information that describes what relations exist in the database, the format of their attributes, and what attributes have indices on them, is also stored in relations • This schema is called the catalogs.
There are two main catalogs: • relCat • attrCat • The relCat relation is used to keep track of all of the relations in the database. • It contains one tuple for each relation. • The attrCat relation is used to maintain information about the attributes of each relation. • It contains one tuple for each attribute of each relation
Relation Catalog • Relation Description Component • Relation name • Relation Length • Attribute count • Record count • Sort Field • Format
Attribute Information Component • Attribute number • Attribute Offset • Attribute length • Attribute Type • Attribute Name • Relation Name
Attribute Catalog • Attribute Description Component • Relation Name • Attribute Name • Attribute Offset • Attribute Type • Attribute Length • Indexed
Attribute Catalog Class Methods • Status getInfo( char* relation, char* attrName, attrDesc& record); • Status addInfo(AttrDesc record); • Status removeInfo(char* relation, char* attrName); • Status getRelInfo(char* relation, int& attrCnt, AttrDesc*& attrs); • Status dropRelation(char* relation); • Status addIndex(char* relation, char* attrname); • Status dropIndex(char* relation, char* attrname);
Relation Catalog Class Methods • Status createRel (char* relation, int attrCnt, attrInfo attrList[ ]); • Status destroyRel (char* relation); • Status addIndex (char* relation, char* attrname); • Status dropIndex (char* relation, char* attrname); • Status addInfo (RelDesc record); • Status getInfo (char* relation, RelDesc& record); • Status help (char* relation );
Relation Name Record Length Attribute Count Record Count Sort field Format Relation Catalog
Attribute Number Attribute Offset Attribute Length Attribute Type Attribute Name Relation Name Attribute Catalog
Lets look at the Assignment • And the hand out