Product: MapBasic
Version: 6.5
Platform: Not Platform Related
Category: Documentation
Summary:
Set Table - Description
Question:
How is the set table statement used?
Answer:
Set Table Statement
Purpose
Configures various settings of an open table.
Syntax
Set Table tablename
[ FastEdit { On | Off } ]
[ Undo { On | Off } ]
[ ReadOnly ]
[ Seamless { On | Off } [ Preserve ] ]
[ UserMap { On | Off } ]
[ UserBrowse { On | Off } ]
[ UserClose { On | Off } ]
[ UserEdit { On | Off } ]
[ UserRemoveMap { On | Off } ]
[ UserDisplayMap { On | Off } ]
Description
The Set Table statement controls settings that affect how and whether a table can be edited. Use Set Table to flag a table as read-only (so that the user will not be allowed to make changes to the table). Use Set Table to activate or de-activate special editing modes which disable safety mechanisms for the sake of improving editing performance.
Setting FastEdit Mode
Ordinarily, whenever a table is edited (either by the user or by a MapBasic application), MapInfo does not immediately write the edit to the affected table. Instead, MapInfo stores information about the edit to a temporary file known as a transaction file. By writing to a transaction file instead of writing directly to a table, MapInfo gives the user the opportunity to later discard the edits (e.g. by choosing File > Revert). If using the Set Table statement to set FastEdit mode to On, MapInfo writes edit information directly to the table, instead of performing the intermediate step of writing the edit information to a transaction file. Turning on FastEdit mode can make subsequent editing operations substantially faster.
While FastEdit mode is on, table edits take effect immediately, even if a Commit statement is not used. Use FastEdit mode with caution; there is no opportunity to discard edits by choosing File>Close or File>Revert.
FastEdit mode can only be turned on for normal, base tables; FastEdit can not be turned on for a temporary, query table such as Query1. FastEdit mode can not be turned on for a table that already has unsaved changes. FastEdit mode can not be turned on for a linked table.
Caution: While a table is open in FastEdit mode, other network users cannot open that table. After all edits to be made in FastEdit mode have been completed, issue a Commit statement or a Rollback statement. By issuing a Commit or Rollback statement, the file is reset so that other network users can access it.
Setting Read-Only Mode
If the optional ReadOnly clause is included, the table is set to read-only, so that the user cannot edit the table for the remainder of the MapInfo session. The Set Table statement does not allow read-only mode be set to off. It is also possible to activate read-only mode by adding the ReadOnly keyword to the Open Table statement.
Setting Undo Mode
Ordinarily, whenever an edit is made, MapInfo stores information about the edit in memory, so that the user has the option of choosing Edit>Undo. If using the Set Table statement to set Undo mode to Off, MapInfo does not save undo information for each edit; this can make subsequent editing operations substantially faster.
Managing Seamless Tables
MapInfo 4.0 and greater supports a table type known as seamless tables. A seamless table defines a list of other tables that can be treated as a group. See the MapInfo documentation for an introduction to seamless tables.
The Seamless clause enables or disables the seamless behavior for a table. Specify Seamless Off to disable seamless behavior, so that the individual rows that define a seamless table can be accessed. Specify Seamless On to restore seamless behavior. If the Preserve keyword is included, the effect is permanent; MapInfo writes a change to the table. If the Preserve keyword is omitted, the effect is temporary, only lasting for the remainder of the session.
Preventing the User from Accessing Tables
The User... clauses allow the actions that the user can perform on a table be limited. These clauses are useful if it is desired to prevent the user from accidentally opening, closing, or changing tables or windows.
These clauses limit the user-interface only; in other words, UserMap Off prevents the user from opening the table in a Map window, but does not prevent a MapBasic program from doing so. Note: These clauses cannot be used on Cosmetic layers.
Example Effect
UserMap Off Table will not appear in the New Map Window or Add Layer dialog boxes.
UserBrowse Off Table will not appear in the New Browser Window dialog box.
UserClose Off Table will not appear in the Close Table dialog.
UserEdit Off Table will not be editable through the user interface:
Browser and Info windows are not editable, and the map layer cannot be made editable.
UserRemoveMap Off If this table appears in a Map window, the Remove button (in the Layer Control dialog box) is disabled for this table.
UserDisplayMap Off If this table appears in a Map window, the Display check box (in the Layer Control dialog box) is disabled for this table.
Example
The following statement prevents the World table from appearing in the Close Table dialog.
Set Table World UserClose Off
See Also
Creating and modifying tables
Last Modified:
|