Switch to: V12V11V10V9V8V7V6V5

Link Terminology

The path between link and table. A link must have at least 2 branches to be able to link 2 tables. If a link links more than 2 tables, it is called an N-branch link.

In most cases developers work with the simplest case: the 2-branch links. Taking this into account Valentina provides 2 major interfaces to work with links:

VLink - this interface contains the most general API, which can be used for N-branch links.

VLink2 - this interface extends VLink by additional methods that make working with 2-branch links more comfortable. A group of methods make sense for VLink2 only, for example get_OppositeTable().

This parameter describes how records of tables are linked. For example, there are possible

  • 1 : 1 - one record of the Left Table linked to 0 or 1 records of the Right Table.
  • 1 : M - one record of the Left Table is linked to 0,1,2, … records of the Right Table. Each record of the Right Table can be linked only to 0 or 1 records of the Left Table.
  • M : 1 - this is the mirror case of the 1 : M link. Switch the places of the tables, and you will get the previous case.
  • M : M - each record of the Left Table can be linked to 0, 1, 2, … records of the Right Table. In the same time, each record of the Right Table also can be linked to 0,1,2,… records of the Left Table.

Left, Right Tables

For VLink2 the most general names we can assign to tables are Left Table and Right Table. Actually, in the cases 1:1 and M:M there is a symmetry and tables on default have equal rights.

Owner Table

In a 1 : M kind of link, we can consider a record of the Left Table to be the Owner of records of the Right Table. Often this is underlined by names like “Parent Table” for the Left Table and “Child Table” for the Right Table.

Developers also often use names like “One Table” and “Many Table”. This as well points out very clearly which table the developer means.

For symmetric links as 1 : 1 and M : M we do not have a default Owner Table for a link. For example, let's assume we've got the tables “Person” and “Phone”, linked as M : M. One person is not owner of a phone number, the same phone number can belong to other persons at the same time. Even if a phone belongs to a single person, the death of this person does not mean the death of the phone. Person and Phone are totally independent entities of the real world.

For symmetric cases, VLink on default does not have an Owner Table, so action ON DELETE does not make sense. If you want to use these action, you must to specify an Owner Table using the VLink.Owner property.