Switch to: V11V10V9V8V7V6V5

VDatabase Elements Overview

Each Valentina Database can have one or more collections of elements. Different collections of Valentina database are listed below. For each collection you can

  • get the count of elements.
  • get each element by index (1-based).
  • get each element by name.
  • get each element by ID (not all collections support this).

Tables

In order to be valid, each database has to contain at least one valid Table. If you do not have any table in the database then you cannot store your information.

You can create a new table using CreateTable() method and delete the table using DropTable().

There is no limit on the number of tables. Information about a Table is stored in the system tables.

Views

A VIEW is kind of virtual table expressed in the form of SELECT statement. For end user VIEW looks like one more table in the database. Although exists limitations in some cases, e.g. VIEW built on join is read only.

Database can have as many VIEWs as you need. In the Database Schema only SQL string is stored.

Triggers

A Table can have Triggers - some SQL command, which is invoked automatically by engine if happens such event as INSERT/UPDATE/DELETE. Trigger can be invoked BEFORE or AFTER event.

Although Triggers are elements of Table first of all, they are registered by database into single collection, so triggers must have unique name in the scope of database.

Please note, that you can manage Triggers using only SQL commands, there is no API commands for this.

Stored Routines

Database can contains Stored Routines that can be Procedures and User Defined Functions.

Links can exist between tables.

You can create a link using different ways:

  • VDatabase.CreateBinaryLink() method.
  • creating an ObjectPtr field in a table.
  • creating FOREIGN KEY constraint.

Deletion of link happens using VDatabase.DropLink() or if delete ObjectPtr field or if you delete FOREIGN KEY constraint.

There is no limit on the number of links. Information about a Link is stored in the system tables.

Indexes

You can create/drop index using:

  • API methods Database.CreateIndex() and VDatabase.DropIndex().
  • SQL92 commands CREATE INDEX and DROP INDEX.
  • property VField.IsIndexed.

There is no limit on the number of Indexes. Information about an Indexes is stored in the system tables.

IndexStyles

Database can have one or several index styles. Index styles must be created before Tables, because tables will use them. IndexStyles should not be chnaged or deleted (at least in the current version).

There is no limit on the number of IndexStyles. Information about an IndexStyle is stored in the system tables.

Cursors

You can create VCursor object using VDatabase.SqlSelect() method. You should destroy cursor as soon as possible to unlock records. If you close database that still have cursors then VDatabase object self will destroy them.

Cursor are not persistent objects, so information about cursors is not stored in the system tables.