Switch to: V10V9V8V7V6V5

VTable Permanency

Permanency of some object means that if this object was alive after database was closed, the application would be finished, computer would be turned off. To provide permanency of an object, it is stored to hard disk. Actually one of main job of a database - provide permanency of data that we store to database.

When you create a new Table, Valentina database allows you to specify its permanency:

  • Permanent (default)
  • Temporary.

Permanent Tables

A Permanent Table is a regular table, which we use in any DBMS. A Permanent Table is stored on the hard disk, and lives after database was closed.

Valentina keeps data of such Table in the ”.dat” file of a Valentina database (in case you use db_mode with .dat file).

Temporary Tables

Temporary tables are similar to permanent tables, except temporary tables are stored in ”.tmp” volume and are deleted automatically on database close.

Valentina keeps data of temporary table in the ”.tmp” file, stored in the special TMP folder of OS. Besides, information about temporary table is NOT stored in the schema of Valentina database in the .vdb file. Thanks to all this, in case of system failure your .vdb and .dat files are not affected by any temporary table! OS itself will trash .tmp file on the next restart.

Summarizing, life of temporary table can be finished by:

  • DROP TABLE
  • CLOSE DB
  • Valentina's SHUTDOWN
  • SYSTEM FAILURE

Linking Temporary Tables

Interesting question to consider is: IF and HOW temporary tables can be linked with permanent tables?

RULE:

VLink that links at least one temporary Table self becomes temporary even if developer have not specify this creating link.

Example:

Let we have:

  • T1 and T2 Tables.
  • T1 is permanent table on disk.
  • T2 is Temporary table on disk or RAM.
  • T2 Table may have FK or ObjectPtr field that points T1 or we may have binary link between T1 and T2.

The following table shows allowed combinations.

T1 (PERM) T2 (TMP) FK(in T2) ObjectPtr(in T2) BinaryLink
DISK DISK DISK DISK TMP on DISK/RAM
DISK RAM RAM RAM TMP on DISK/RAM

Example:

Let we have:

  • T1 and T2 Tables.
  • T1 is Temporary table on disk or RAM.
  • T2 is Permanent table on disk.
  • T2 Table may have FK or ObjectPtr field that points T1 or we may have binary link between T1 and T2.

The following table shows allowed combinations.

T1 (TMP) T2 (PERM) FK(in T2) ObjectPtr(in T2) BinaryLink
DISK DISK TMP on DISK/RAM TMP on DISK/RAM TMP on DISK/RAM
RAM DISK TMP on DISK/RAM TMP on DISK/RAM TMP on DISK/RAM

NOTE: that ObjectPtr and FK can point temporary table T1 only if these fields self are TMP fields. Yes, yes, yes. Let us remind you that Valentina is unique DBMS, which allows you to have TEMPORARY FIELDS in Permanent Tables.