
Effects of various database features on Squidhead
Foreign Keys
Figure 1. Foreign key relationship.
If a foreign key relationship is defined between two tables the following will occur:
Figure 4. Example of many to many relationship as setup for use in Squidhead.
If a foreign key relationships are setup such that they define a many to many relationship through a linking table the following will occur:
- Stored Procedures
- Proc for table will be created named “usp_[tableName]_select_by_unique_join” which will return the record that has the primary key values of both linked tables.
- Business Objects
- * Business objects for each linked table will have an add and remove method for the other table which will create relationships for them in the liking table.
- UI
- * Read method will list records in linked table through the linking table.
- * Read method displays form that allows for created related records in the linked table through the linking table.
In order for this to happen:
- The linking table needs to have the primary key of each other table set as a foreign key
- The foreign keys need to have the same name
- The table needs to be named tableToTable.
Unique Constraints
When a unique constraint is set for a column the following occurs:
- Stored Procedures
- A stored procedure named “usp_[tableName]_select_by_uniquecolumn” is created
- Business Objects
- * The init method read in a record based on its unique record by setting the Keyfield and keyValue arguments to the appropriate item
- UI
- * Ui will allow you to link records by just passing in the unique column, rather than the whole value
* - Only occurs in fkCrazy template.