Table of Contents
Valentina Database Link
Working with tables, a database designer often establishes links between two or more tables.
Starting with Valentina 2.0 the Valentina Database Model extends the traditional relational model by adding the new abstraction: Link.
The adding of the Valentina Link (VLink object) means that developers can use both API and SQL commands to create, delete and modify links between tables, as well as to link/unlink records, use links for joins and other database operations - in a new and highly efficient way.
Links are very easy to understand and could probably be considered a reincarnation of links from The Network Database Model.
It is easy to see that links should provide the following features:
- Each link has a unique ID.
- Each link has a unique name in the scope of the database. Link names and table names are in the same scope.
- The database knows about each of its links.
- Each table knows about each of its links.
- You can access a table link by name or index.
- Each link knows what tables it links and how.
Description of Links
Valentina currently offers three kinds of links between 2 tables that implement the VLink2 interface:
- Link Terminology - Discusses such terms of the
Link
abstraction as Branches, Power, Owner, … - Pointer Links - Discusses the pointer nature of Foreign Key and ObjectPtr links.
- Valentina Links on Diagrams - Explains how three kinds of Valentina links are shown on diagrams.
Comparison of Links
You can compare the types of Valentina links here:
Link API
Links in SQL
- Link Functions - COUNT_LINKED(), MAX_LINKED(), MIN_LINKED(), SUM_LINKED(), etc …
- Operator -> - for M:1 links, as ObjectPtr and ForeignKey.
Refactoring of Links
During development, a developer can change the type of link to better fit its task-specific requirements. This section describes how to change one kind of link into another using Valentina's built-in refactoring features.