Purpose
Version-enables or disables a table on Oracle 9i or later, which creates or deletes all the necessary structures to support multiple versions of rows to take advantage of Oracle Workspace Manager. You can issue this statement from the MapBasic window in MapInfo Pro.
Syntax
Server ConnectionNumber Versioning {
ON [ History HistoryValue ] |
OFF [ Force { OFF | ON } ]
} Table ServerTableName
ON | OFF indicates to enable (when it is ON ) a table versioning or disable (when it is OFF) a table versioning.
ConnectionNumber is an integer value that identifies the specific connection.
ServerTableName is the name of the table on Oracle server to be version-enabled/disabled. The length of a table name must not exceed 25 characters. The name is not case sensitive.
History is an optional parameter when version-enabling a table (ON).
History clause specifies how to track modifications to ServerTableName, for example, lets you timestamp changes made to all rows in a version-enabled table and to save a copy of either all changes or only the most recent changes to each row. HistoryValue must be one of the following constant values:
- SRV_WM_HIST_NONE (0): No modifications to the table are tracked. (This is the default.)
- SRV_WM_HIST_OVERWRITE (1): The with overwrite (W_OVERWRITE) option. A view named ServerTableName_HIST is created to contain history information, but it will show only the most recent modifications to the same version of the table. A history of modifications to the version is not maintained; that is, subsequent changes to a row in the same version overwrite earlier changes. (The CREATETIME column of the TableName_HIST view contains only the time of the most recent update.)
- SRV_WM_HIST_NO_OVERWRITE (2): The without overwrite (WO_OVERWRITE) option. A view named ServerTableName_HIST is created to contain history information, and it will show all modifications to the same version of the table. A history of modifications to the version is maintained; that is, subsequent changes to a row in the same version do not overwrite earlier changes.
However, there are many restrictions on tables to use this option. Please refer the Oracle9i Application Developer's Guide - Workspace Manager for more information.
Force is an optional parameter, when disabling a version-enabled table (OFF).
If Force is set ON, all data in workspaces other than LIVE to be discarded before versioning is disabled. OFF (the default) prevents versioning from being disabled if ServerTableName was modified in any workspace other than LIVE and if the workspace that modified ServerTableName still exists.
Description
This statement only applies to Oracle9i or later. The table, ServerTableName, that is being version-enabled must have a primary key defined. Only the owner of a table or a user with the WM_ADMIN role can enable or disable versioning on the table. Tables that are version-enabled and users that own version-enabled tables cannot be deleted. You must first disable versioning on the relevant table or tables. Tables owned by SYS cannot be version-enabled. Refer to the Oracle9i Application Developer's Guide - Workspace Manager for more information.
Examples
The following example enables versioning on the MIUUSA3 table.
Dim hdbc As Integer
hdbc = Server_Connect("ORAINET", "SRVR=TROYNY;UID=MIUSER;PWD=MIUSER")
Server hdbc Versioning ON Table "MIUUSA3"
or
Server hdbc Versioning ON History 1 Table "MIUUSA3"
The following example disables versioning on the MIUUSA3 table.
Dim hdbc As Integer
hdbc = Server_Connect("ORAINET", "SRVR=TROYNY;UID=MIUSER;PWD=MIUSER")
Server hdbc Versioning OFF Force ON Table "MIUUSA3"
See Also:
Server Create Workspace statement