home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-14 | 2.6 KB | 102 lines | [TEXT/ttxt] |
- integer totalcalls = 25;
- integer currcall = 5;
-
- declare procedure progress(message)
- argument varchar message;
- {
- currcall++;
- print $progress, currcall*100/totalcalls, $format("Creating Telephone Database:\r")+message, 0;
- }
- end procedure progress;
-
- progress("One moment please...");
- create database :DatabaseName;
-
- progress("Opening the database...");
- open database :DatabaseName;
-
- progress("Domain: NameType");
- CREATE DOMAIN Common.NameType VARCHAR(64) order as case insensitive;
-
- progress("Domain: DeptCode");
- CREATE DOMAIN Common.DeptCode INTEGER;
-
- progress("Domain: TypeCode");
- CREATE DOMAIN Common.TypeCode INTEGER;
-
- progress("Domain: PersonID");
- CREATE DOMAIN Common.PersonID INTEGER;
-
- progress("Table: Department");
- CREATE TABLE Common.Department
- (
- Code DeptCode NOT NULL,
- Name NameType
- );
- progress("Primary Key on Department");
- CREATE PRIMARY KEY Common.DepartmentPk ON Department.Code;
- CREATE INDEX Common.iDepartment ON Department(Code);
-
- progress("Table: Type");
- CREATE TABLE Common.Type
- (
- Code TypeCode NOT NULL,
- Name NameType
- );
- progress("Primary Key on Type");
- CREATE PRIMARY KEY Common.TypePk ON Type.Code;
- CREATE INDEX Common.iType ON Type(Code);
-
- progress("Table: Person");
- CREATE TABLE Common.Person
- (
- ID PersonID NOT NULL,
- Name NameType,
- Surname NameType,
- Department DeptCode
- )
- progress("Primary Key on Person");
- CREATE PRIMARY KEY Common.PersonPk ON Person.ID;
- CREATE INDEX Common.iPerson ON person(ID);
- progress("Foreign Key: Person -> Department");
- CREATE FOREIGN KEY Common.PersonDeptFk ON Person.Department;
- CREATE INDEX Common.iNameSurname ON person (name, surname);
- CREATE INDEX Common.iSurname ON person (surname);
-
- progress("Table: Department");
- CREATE TABLE Common.Number
- (
- Person PersonID NOT NULL,
- Type TypeCode NOT NULL,
- Number VARCHAR(64),
- Key (Person, Type)
- );
- progress("Primary Key on Department");
- CREATE PRIMARY KEY Common.NumberPk ON Number.Key;
- CREATE INDEX Common.iNumber ON Number(Key);
- progress("Foreign Key: Department -> Person");
- CREATE FOREIGN KEY Common.NumberPersonFk ON Number.Person;
- progress("Foreign Key: Department -> Type");
- CREATE FOREIGN KEY Common.NumberTypeFk ON Number.Type;
- CREATE INDEX Common.iTypePerson ON Number (Type, Person);
-
- progress("Inserting empty department...");
- INSERT Department VALUES (1, "-");
-
- progress("Inserting default number types...");
- INSERT Type VALUES (1, "Work");
- INSERT Type VALUES (2, "Extension");
- INSERT Type VALUES (3, "Home");
- INSERT Type VALUES (4, "Mobile");
-
- progress("Inserting a dummy number...");
- INSERT Person VALUES (100, "John", "Doe", 1);
-
- INSERT Number VALUES (100, 1, "12345");
-
- progress("Completed successfully");
-
-
-
-
-