VirtualMV/Web Development/Web Site Issues/Integrity/Content

From WikiEducator
Jump to: navigation, search


According to the Merriam-Webster (Intregity, 2014)[1]there are two branches of integrity and both meanings are used in Web development

  • For humans (developer, client, user)
    • the quality of being honest and fair
  • For data/databases
    • the state of being complete or whole

Human integrity

  • For Developers and IT Professionals this is often governed by a voluntary professional code of conduct
  • For Clients and Users this can have many interpretations and may be affected by cultural factors. Things that fall into this category include:
    • Downloading movies, sounds and images
    • Copying look and feel, web sites, multimedia etc.

Database integrity

Most online systems have at their core a database, and the database is valuable only if the data in it is correct. Taylor (2006, pp. 104-)[2] identifies three kinds of database integrity.

  • Entity integrity
  • Domain integrity
  • Referential integrity

Entity integrity

An entity corresponds to something in the real world. As such you must be able to connect the entry in the database with the correct one in the real world. This is commonly achieved by specifying a primary key in the table that allows each record to be unique. In the Person table an entity integrity error could occur if we try to add a person with an ID (PerID) which is already in the table.

INSERT INTO tblPerson  VALUES (1,'G Raff','F', 'AA999887');

Domain integrity

Many data items can only take specific values, for example, gender in tblPerson can only be Male (M) or Female (F). MySQL provides the ENUM data type.

So if you tried to add or update a Persons record containing "X" for gender this would fail domain integrity

INSERT INTO tblPerson  VALUES (\N,'Ba Boon','X', 'AA767676');
UPDATE tblPerson SET PerGender = 'X' WHERE PerID = 2;

Referential integrity

An example of Referential integrity is when an Item is added to the database it MUST belong to a Person. So before a Item can be entered the Person MUST be created. Referential Integrity will fail if the Item is added before the Person is created.

  (\N,999,'Gazontite DVD Player GZ123','GZ11335577',987);

Here the PerID 999 must be created first in the Person table
Cite error: <ref> tags exist, but no <references/> tag was found