The open table statement opens a table buffer with the same name as the table, or opens a table buffer for a named table using a different name for the buffer.
open table table_name {with name string_expr } {, exclusive} {blocksize size} {as database_type {, pathname}}
• table_name – The name of the table to be opened.
• with name string_expr – This clause can be used to open a table buffer for a given table, while naming the newly-opened buffer something other than the table’s name. This is used for local anonymous tables.
• exclusive – This keyword indicates that the table will be opened for exclusive use, ensuring that only the script or form opening the table will have access to it. Exclusive use of a table is necessary to use the delete table statement to delete the table from the operating system or database.
• blocksize size – This clause only applies when a SQL database type is used. It is an integer value indicating the size of the cursor block to use for actions on this table. The maximum block size allowed is 255 records. If a number greater than 255 is specified, 255 will be used.
• as database_type –A constant indicating the database type that will be used when opening the table. If this parameter isn’t used, the database type specified in the table’s definition will be used. The following table lists the constants and corresponding database type:
Constant |
Description |
---|---|
DB_TYPE_SQL |
Uses SQL as the database type |
DB_TYPE_CTREE |
Uses c-tree Plus as the database type |
DB_TYPE_BTRIEVE |
Uses Pervasive.SQL as the database type |
DB_TYPE_MEMORY |
Uses a memory-based table |
DB_TYPE_TABLEDEFAULT |
Uses the database type specified in the table definition. If Default is selected in the table definition, the database type specified in the command line or the defaults file DatabaseType setting is used. |
• pathname – A variable string value indicating the location where the table will be opened. This parameter will override the path returned by the Pathname or SQLPath procedure. While the as database_type parameter can be used alone, the pathname parameter can be used only in conjunction with the as database_type parameter.
Generic pathnames use a colon (:) before and after server names or drive letters. Forward slashes are used after every directory, folder name or database name.
You shouldn’t have to use this statement very often, as tables are automatically opened when they are accessed by a form.