Table_SetCreateMode()

Examples


The Table_SetCreateMode() function allows you to choose whether tables that don’t already exist will be created automatically when they are accessed at runtime.

Syntax

Table_SetCreateMode(option)

Parameters

option – A boolean that sets the table creation mode:

[spacer]

Value

Description

true

Automatically creates the table if it isn’t found.

false

Doesn’t create the table if it isn’t found.


Return value

The boolean value true.

Comments

Dexterity’s default functionality is to automatically create the table if it isn’t found. When a table operation is issued to run against a given table, a two-step process is performed. Dexterity first checks the database to verify whether the table exists. If the table doesn’t exist, Dexterity will create it. Once the existence of the table is verified, Dexterity returns to the database to execute the issued command. If you set the autocreate option to false, the verification step will be skipped, which may improve application performance. However, if the table isn’t found, an error message will be displayed.

Typically, the Table_SetCreateMode() function is used when a table is accessed the first time in the application. Automatic table creation is turned off, error reporting is turned off, and a get first operation is performed on the specific table. If an error occurred when a table was accessed, the table didn’t exist in the location indicated. The application can then respond appropriately by allowing the user to locate the table or tables that couldn’t be accessed. Once the table has been located and successfully opened, automatic table creation and error checking can be turned back on.

Regardless of which functionality is chosen, temporary tables will be automatically created as needed.

When Table_SetCreateMode() is set to false, explicitly opening a SQL table with the open table statement will never produce an error, even if the table does not exist.



Documentation Feedback